OLD | NEW |
(Empty) | |
| 1 ; Test encoding of MIPS32 arithmetic instructions |
| 2 |
| 3 ; REQUIRES: allow_dump |
| 4 |
| 5 ; Compile using standalone assembler. |
| 6 ; RUN: %p2i --filetype=asm -i %s --target=mips32 --args -O2 \ |
| 7 ; RUN: --allow-externally-defined-symbols --skip-unimplemented \ |
| 8 ; RUN: | FileCheck %s --check-prefix=ASM |
| 9 |
| 10 ; Show bytes in assembled standalone code. |
| 11 ; RUN: %p2i --filetype=asm -i %s --target=mips32 --assemble --disassemble \ |
| 12 ; RUN: --args -O2 --allow-externally-defined-symbols --skip-unimplemented \ |
| 13 ; RUN: | FileCheck %s --check-prefix=DIS |
| 14 |
| 15 ; Compile using integrated assembler. |
| 16 ; RUN: %p2i --filetype=iasm -i %s --target=mips32 --args -O2 \ |
| 17 ; RUN: --allow-externally-defined-symbols --skip-unimplemented \ |
| 18 ; RUN: | FileCheck %s --check-prefix=IASM |
| 19 |
| 20 ; Show bytes in assembled integrated code. |
| 21 ; RUN: %p2i --filetype=iasm -i %s --target=mips32 --assemble --disassemble \ |
| 22 ; RUN: --args -O2 --allow-externally-defined-symbols --skip-unimplemented \ |
| 23 ; RUN: | FileCheck %s --check-prefix=DIS |
| 24 |
| 25 define internal i32 @test_01(i32 %a) { |
| 26 %v = add i32 %a, 1 |
| 27 %v1 = and i32 %v, 1 |
| 28 %v2 = or i32 %v1, 1 |
| 29 %v3 = xor i32 %v2, 1 |
| 30 ret i32 %v3 |
| 31 } |
| 32 |
| 33 ; ASM-LABEL: test_01: |
| 34 ; ASM-NEXT: .Ltest_01$__0: |
| 35 ; ASM-NEXT: # $zero = def.pseudo |
| 36 ; ASM-NEXT: addiu $v0, $zero, 1 |
| 37 ; ASM-NEXT: addu $a0, $a0, $v0 |
| 38 ; ASM-NEXT: # $zero = def.pseudo |
| 39 ; ASM-NEXT: addiu $v0, $zero, 1 |
| 40 ; ASM-NEXT: and $a0, $a0, $v0 |
| 41 ; ASM-NEXT: # $zero = def.pseudo |
| 42 ; ASM-NEXT: addiu $v0, $zero, 1 |
| 43 ; ASM-NEXT: or $a0, $a0, $v0 |
| 44 ; ASM-NEXT: # $zero = def.pseudo |
| 45 ; ASM-NEXT: addiu $v0, $zero, 1 |
| 46 ; ASM-NEXT: xor $a0, $a0, $v0 |
| 47 ; ASM-NEXT: move $v0, $a0 |
| 48 ; ASM-NEXT: jr $ra |
| 49 |
| 50 ; DIS-LABEL:00000000 <test_01>: |
| 51 ; DIS-NEXT: 0: 24020001 li v0,1 |
| 52 ; DIS-NEXT: 4: 00822021 addu a0,a0,v0 |
| 53 ; DIS-NEXT: 8: 24020001 li v0,1 |
| 54 ; DIS-NEXT: c: 00822024 and a0,a0,v0 |
| 55 ; DIS-NEXT: 10: 24020001 li v0,1 |
| 56 ; DIS-NEXT: 14: 00822025 or a0,a0,v0 |
| 57 ; DIS-NEXT: 18: 24020001 li v0,1 |
| 58 ; DIS-NEXT: 1c: 00822026 xor a0,a0,v0 |
| 59 ; DIS-NEXT: 20: 00801021 move v0,a0 |
| 60 ; DIS-NEXT: 24: 03e00008 jr ra |
| 61 ; DIS-NEXT: 28: 00000000 nop |
| 62 |
| 63 ; IASM-LABEL: test_01: |
| 64 ; IASM-LABEL: .Ltest_01$__0: |
| 65 ; IASM-NEXT: .byte 0x1 |
| 66 ; IASM-NEXT: .byte 0x0 |
| 67 ; IASM-NEXT: .byte 0x2 |
| 68 ; IASM-NEXT: .byte 0x24 |
| 69 ; IASM-NEXT: .byte 0x21 |
| 70 ; IASM-NEXT: .byte 0x20 |
| 71 ; IASM-NEXT: .byte 0x82 |
| 72 ; IASM-NEXT: .byte 0x0 |
| 73 ; IASM-NEXT: .byte 0x1 |
| 74 ; IASM-NEXT: .byte 0x0 |
| 75 ; IASM-NEXT: .byte 0x2 |
| 76 ; IASM-NEXT: .byte 0x24 |
| 77 ; IASM-NEXT: .byte 0x24 |
| 78 ; IASM-NEXT: .byte 0x20 |
| 79 ; IASM-NEXT: .byte 0x82 |
| 80 ; IASM-NEXT: .byte 0x0 |
| 81 ; IASM-NEXT: .byte 0x1 |
| 82 ; IASM-NEXT: .byte 0x0 |
| 83 ; IASM-NEXT: .byte 0x2 |
| 84 ; IASM-NEXT: .byte 0x24 |
| 85 ; IASM-NEXT: .byte 0x25 |
| 86 ; IASM-NEXT: .byte 0x20 |
| 87 ; IASM-NEXT: .byte 0x82 |
| 88 ; IASM-NEXT: .byte 0x0 |
| 89 ; IASM-NEXT: .byte 0x1 |
| 90 ; IASM-NEXT: .byte 0x0 |
| 91 ; IASM-NEXT: .byte 0x2 |
| 92 ; IASM-NEXT: .byte 0x24 |
| 93 ; IASM-NEXT: .byte 0x26 |
| 94 ; IASM-NEXT: .byte 0x20 |
| 95 ; IASM-NEXT: .byte 0x82 |
| 96 ; IASM-NEXT: .byte 0x0 |
| 97 ; IASM-NEXT: .byte 0x21 |
| 98 ; IASM-NEXT: .byte 0x10 |
| 99 ; IASM-NEXT: .byte 0x80 |
| 100 ; IASM-NEXT: .byte 0x0 |
| 101 ; IASM-NEXT: .byte 0x8 |
| 102 ; IASM-NEXT: .byte 0x0 |
| 103 ; IASM-NEXT: .byte 0xe0 |
| 104 ; IASM-NEXT: .byte 0x3 |
| 105 ; IASM-NEXT: .byte 0x0 |
| 106 ; IASM-NEXT: .byte 0x0 |
| 107 ; IASM-NEXT: .byte 0x0 |
| 108 ; IASM-NEXT: .byte 0x0 |
| 109 |
| 110 define internal i32 @test_02(i32 %a) { |
| 111 %cmp = icmp eq i32 %a, 9 |
| 112 %cmp.ret_ext = zext i1 %cmp to i32 |
| 113 ret i32 %cmp.ret_ext |
| 114 } |
| 115 |
| 116 ; ASM-LABEL: test_02: |
| 117 ; ASM-NEXT: .Ltest_02$__0: |
| 118 ; ASM-NEXT: # $zero = def.pseudo |
| 119 ; ASM-NEXT: addiu $v0, $zero, 9 |
| 120 ; ASM-NEXT: xor $a0, $a0, $v0 |
| 121 ; ASM-NEXT: sltiu $a0, $a0, 1 |
| 122 ; ASM-NEXT: andi $a0, $a0, 1 |
| 123 ; ASM-NEXT: move $v0, $a0 |
| 124 ; ASM-NEXT: jr $ra |
| 125 |
| 126 ; DIS-LABEL:00000030 <test_02>: |
| 127 ; DIS-NEXT: 30: 24020009 li v0,9 |
| 128 ; DIS-NEXT: 34: 00822026 xor a0,a0,v0 |
| 129 ; DIS-NEXT: 38: 2c840001 sltiu a0,a0,1 |
| 130 ; DIS-NEXT: 3c: 30840001 andi a0,a0,0x1 |
| 131 ; DIS-NEXT: 40: 00801021 move v0,a0 |
| 132 ; DIS-NEXT: 44: 03e00008 jr ra |
| 133 ; DIS-NEXT: 48: 00000000 nop |
| 134 |
| 135 ; IASM-LABEL: test_02: |
| 136 ; IASM-LABEL: .Ltest_02$__0: |
| 137 ; IASM-NEXT: .byte 0x9 |
| 138 ; IASM-NEXT: .byte 0x0 |
| 139 ; IASM-NEXT: .byte 0x2 |
| 140 ; IASM-NEXT: .byte 0x24 |
| 141 ; IASM-NEXT: .byte 0x26 |
| 142 ; IASM-NEXT: .byte 0x20 |
| 143 ; IASM-NEXT: .byte 0x82 |
| 144 ; IASM-NEXT: .byte 0x0 |
| 145 ; IASM-NEXT: .byte 0x1 |
| 146 ; IASM-NEXT: .byte 0x0 |
| 147 ; IASM-NEXT: .byte 0x84 |
| 148 ; IASM-NEXT: .byte 0x2c |
| 149 ; IASM-NEXT: .byte 0x1 |
| 150 ; IASM-NEXT: .byte 0x0 |
| 151 ; IASM-NEXT: .byte 0x84 |
| 152 ; IASM-NEXT: .byte 0x30 |
| 153 ; IASM-NEXT: .byte 0x21 |
| 154 ; IASM-NEXT: .byte 0x10 |
| 155 ; IASM-NEXT: .byte 0x80 |
| 156 ; IASM-NEXT: .byte 0x0 |
| 157 ; IASM-NEXT: .byte 0x8 |
| 158 ; IASM-NEXT: .byte 0x0 |
| 159 ; IASM-NEXT: .byte 0xe0 |
| 160 ; IASM-NEXT: .byte 0x3 |
| 161 ; IASM-NEXT: .byte 0x0 |
| 162 ; IASM-NEXT: .byte 0x0 |
| 163 ; IASM-NEXT: .byte 0x0 |
| 164 ; IASM-NEXT: .byte 0x0 |
OLD | NEW |