| OLD | NEW |
| 1 ; Simple test that returns various immediates. For fixed-width instruction | 1 ; Simple test that returns various immediates. For fixed-width instruction |
| 2 ; sets, some immediates are more complicated than others. | 2 ; sets, some immediates are more complicated than others. |
| 3 ; For x86-32, it shouldn't be a problem. | 3 ; For x86-32, it shouldn't be a problem. |
| 4 | 4 |
| 5 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 \ | 5 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 \ |
| 6 ; RUN: -allow-externally-defined-symbols | FileCheck %s | 6 ; RUN: -allow-externally-defined-symbols | FileCheck %s |
| 7 | 7 |
| 8 ; TODO(jvoung): Stop skipping unimplemented parts (via --skip-unimplemented) | 8 ; TODO(jvoung): Stop skipping unimplemented parts (via --skip-unimplemented) |
| 9 ; once enough infrastructure is in. Also, switch to --filetype=obj | 9 ; once enough infrastructure is in. Also, switch to --filetype=obj |
| 10 ; when possible. | 10 ; when possible. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 define internal i32 @ret_8bits_shift_left24() { | 95 define internal i32 @ret_8bits_shift_left24() { |
| 96 ret i32 4278190080 | 96 ret i32 4278190080 |
| 97 } | 97 } |
| 98 ; CHECK-LABEL: ret_8bits_shift_left24 | 98 ; CHECK-LABEL: ret_8bits_shift_left24 |
| 99 ; CHECK-NEXT: mov eax,0xff000000 | 99 ; CHECK-NEXT: mov eax,0xff000000 |
| 100 ; ARM32-LABEL: ret_8bits_shift_left24 | 100 ; ARM32-LABEL: ret_8bits_shift_left24 |
| 101 ; ARM32-NEXT: mov r0, #-16777216 | 101 ; ARM32-NEXT: mov r0, #-16777216 |
| 102 ; ARM32-NEXT: bx lr | 102 ; ARM32-NEXT: bx lr |
| 103 ; MIPS32-LABEL: ret_8bits_shift_left24 | 103 ; MIPS32-LABEL: ret_8bits_shift_left24 |
| 104 ; MIPS32-NEXT: lui v0,0xff00 | 104 ; MIPS32-NEXT: lui v0,0xff00 |
| 105 ; MIPS32-NEXT: ori v0,v0,0x0 | |
| 106 | 105 |
| 107 ; The next few cases wrap around and actually demonstrate the rotation. | 106 ; The next few cases wrap around and actually demonstrate the rotation. |
| 108 | 107 |
| 109 define internal i32 @ret_8bits_ror7() { | 108 define internal i32 @ret_8bits_ror7() { |
| 110 ret i32 4261412865 | 109 ret i32 4261412865 |
| 111 } | 110 } |
| 112 ; CHECK-LABEL: ret_8bits_ror7 | 111 ; CHECK-LABEL: ret_8bits_ror7 |
| 113 ; CHECK-NEXT: mov eax,0xfe000001 | 112 ; CHECK-NEXT: mov eax,0xfe000001 |
| 114 ; ARM32-LABEL: ret_8bits_ror7 | 113 ; ARM32-LABEL: ret_8bits_ror7 |
| 115 ; ARM32-NEXT: movw r0, #1 | 114 ; ARM32-NEXT: movw r0, #1 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 define internal i32 @ret_16bits_upper() { | 221 define internal i32 @ret_16bits_upper() { |
| 223 ret i32 4294901760 | 222 ret i32 4294901760 |
| 224 } | 223 } |
| 225 ; CHECK-LABEL: ret_16bits_upper | 224 ; CHECK-LABEL: ret_16bits_upper |
| 226 ; CHECK-NEXT: mov eax,0xffff0000 | 225 ; CHECK-NEXT: mov eax,0xffff0000 |
| 227 ; ARM32-LABEL: ret_16bits_upper | 226 ; ARM32-LABEL: ret_16bits_upper |
| 228 ; ARM32-NEXT: movw r0, #0 | 227 ; ARM32-NEXT: movw r0, #0 |
| 229 ; ARM32-NEXT: movt r0, #65535 | 228 ; ARM32-NEXT: movt r0, #65535 |
| 230 ; MIPS32-LABEL: ret_16bits_upper | 229 ; MIPS32-LABEL: ret_16bits_upper |
| 231 ; MIPS32-NEXT: lui v0,0xffff | 230 ; MIPS32-NEXT: lui v0,0xffff |
| 232 ; MIPS32-NEXT: ori v0,v0,0x0 | |
| 233 | 231 |
| 234 | 232 |
| 235 ; Some 32-bit immediates can be inverted, and moved in a single instruction. | 233 ; Some 32-bit immediates can be inverted, and moved in a single instruction. |
| 236 | 234 |
| 237 define internal i32 @ret_8bits_inverted_shift_left0() { | 235 define internal i32 @ret_8bits_inverted_shift_left0() { |
| 238 ret i32 4294967040 | 236 ret i32 4294967040 |
| 239 } | 237 } |
| 240 ; CHECK-LABEL: ret_8bits_inverted_shift_left0 | 238 ; CHECK-LABEL: ret_8bits_inverted_shift_left0 |
| 241 ; CHECK-NEXT: mov eax,0xffffff00 | 239 ; CHECK-NEXT: mov eax,0xffffff00 |
| 242 ; ARM32-LABEL: ret_8bits_inverted_shift_left0 | 240 ; ARM32-LABEL: ret_8bits_inverted_shift_left0 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 ; CHECK-LABEL: ret_addr | 320 ; CHECK-LABEL: ret_addr |
| 323 ; CHECK-NEXT: mov eax,0x0 {{.*}} R_386_32 _start | 321 ; CHECK-NEXT: mov eax,0x0 {{.*}} R_386_32 _start |
| 324 ; ARM32-LABEL: ret_addr | 322 ; ARM32-LABEL: ret_addr |
| 325 ; ARM32-NEXT: movw r0, #0 {{.*}} R_ARM_MOVW_ABS_NC _start | 323 ; ARM32-NEXT: movw r0, #0 {{.*}} R_ARM_MOVW_ABS_NC _start |
| 326 ; ARM32-NEXT: movt r0, #0 {{.*}} R_ARM_MOVT_ABS _start | 324 ; ARM32-NEXT: movt r0, #0 {{.*}} R_ARM_MOVT_ABS _start |
| 327 ; TODO(RKotler) emitting proper li but in disassembly | 325 ; TODO(RKotler) emitting proper li but in disassembly |
| 328 ; it shows up only in the relocation records. Should emit | 326 ; it shows up only in the relocation records. Should emit |
| 329 ; without the macro but we still need to add GOT implementation | 327 ; without the macro but we still need to add GOT implementation |
| 330 ; to finish this case | 328 ; to finish this case |
| 331 ; | 329 ; |
| OLD | NEW |