! !Purposes: !This programs tests if the assembler can detect and report !invalid immediate values !Description: !A representative operation is choosen for each instruction type !and the following range of immediate values are tested: !(1) the minimum possible value that should be accepted !(2) zero (if it is not already the minimum possible value) !(3) a middle range negative value (if allowed) !(4) a middle range positive value !(5) the maximum possible value that should be accepted !(6) a negative value that exceeds the minimum possible value ! (should generate a warning message and require truncation) !(7) a positive value that exceeds the maximum possible value ! (should generate a warning message and require truncation) .section ".text" !Arithmetic Instructions add %r1, -4096, %r3 add %r1, 0, %r3 add %r1, -500, %r3 add %r1, 500, %r3 add %r1, 4095, %r3 add %r1, -4097, %r3 add %r1, 4096, %r3 !Logical Instructions and %r1, -4096, %r3 and %r1, 0, %r3 and %r1, -500, %r3 and %r1, 500, %r3 and %r1, 4095, %r3 and %r1, -4097, %r3 and %r1, 4096, %r3 !Shift Instructions sll %r1, 0, %r3 sll %r1, 15, %r3 sll %r1, 31, %r3 sll %r1, -1, %r3 sll %r1, 32, %r3 !Load Instructions ld [%r1 - 4096], %r3 ld [%r1 + 0], %r3 ld [%r1 - 500], %r3 ld [%r1 + 500], %r3 ld [%r1 + 4095], %r3 ld [%r1 - 4097], %r3 ld [%r1 + 4096], %r3 !Store Instructions st %r3, [%r1 - 4096] st %r3, [%r1 + 0] st %r3, [%r1 - 500] st %r3, [%r1 + 500] st %r3, [%r1 + 4095] st %r3, [%r1 - 4097] st %r3, [%r1 + 4096] !Trap Instructions ta %r1 - 64 ta %r1 + 0 ta %r1 - 50 ta %r1 + 50 ta %r1 + 127 ta %r1 - 65 ta %r1 + 128 !Jump and Link Instructions !Return from Trap Instructions jmpl %r1 - 4096, %r3 rett %r1 - 4096 jmpl %r1 + 0, %r3 rett %r1 + 0 jmpl %r1 - 500, %r3 rett %r1 - 500 jmpl %r1 + 500, %r3 rett %r1 + 500 jmpl %r1 + 4095, %r3 rett %r1 + 4095 jmpl %r1 - 4097, %r3 rett %r1 - 4097 jmpl %r1 + 4096, %r3 rett %r1 + 4096 !Sethi Instructions sethi -0x200000, %r3 sethi 0, %r3 sethi -5000, %r3 sethi 5000, %r3 sethi 0x3fffff, %r3 sethi -0x200001, %r3 sethi 0x400000, %r3 !Save Instructions save %r1, -4096, %r3 save %r1, 0, %r3 save %r1, -500, %r3 save %r1, 500, %r3 save %r1, 4095, %r3 save %r1, -4097, %r3 save %r1, 4096, %r3 !Restore Instructions restore %r1, -4096, %r3 restore %r1, 0, %r3 restore %r1, -500, %r3 restore %r1, 500, %r3 restore %r1, 4095, %r3 restore %r1, -4097, %r3 restore %r1, 4096, %r3 .section ".data" !Byte Storage Directive .byte -128 .byte 0 .byte -50 .byte 50 .byte 255 .byte -129 .byte 256 .align 2 !Half Storage Directive .half -32768 .half 0 .half -500 .half 500 .half 65535 .half -32769 .half 65536