| OLD | NEW |
| 1 ; This tries to be a comprehensive test of i64 operations, in | 1 ; This tries to be a comprehensive test of i64 operations, in |
| 2 ; particular the patterns for lowering i64 operations into constituent | 2 ; particular the patterns for lowering i64 operations into constituent |
| 3 ; i32 operations on x86-32. | 3 ; i32 operations on x86-32. |
| 4 | 4 |
| 5 ; TODO(jvoung): fix extra "CALLTARGETS" run. The llvm-objdump symbolizer | 5 ; TODO(jvoung): fix extra "CALLTARGETS" run. The llvm-objdump symbolizer |
| 6 ; doesn't know how to symbolize non-section-local functions. | 6 ; doesn't know how to symbolize non-section-local functions. |
| 7 ; The newer LLVM 3.6 one does work, but watch out for other bugs. | 7 ; The newer LLVM 3.6 one does work, but watch out for other bugs. |
| 8 | 8 |
| 9 ; RUN: %p2i -i %s --args -O2 --verbose none \ | 9 ; RUN: %p2i -i %s --args -O2 --verbose none \ |
| 10 ; RUN: | FileCheck --check-prefix=CALLTARGETS %s | 10 ; RUN: | FileCheck --check-prefix=CALLTARGETS %s |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 } | 37 } |
| 38 ; CHECK-LABEL: pass64BitArg | 38 ; CHECK-LABEL: pass64BitArg |
| 39 ; CALLTARGETS-LABEL: pass64BitArg | 39 ; CALLTARGETS-LABEL: pass64BitArg |
| 40 ; CHECK: sub esp | 40 ; CHECK: sub esp |
| 41 ; CHECK: mov dword ptr [esp + 4] | 41 ; CHECK: mov dword ptr [esp + 4] |
| 42 ; CHECK: mov dword ptr [esp] | 42 ; CHECK: mov dword ptr [esp] |
| 43 ; CHECK: mov dword ptr [esp + 8], 123 | 43 ; CHECK: mov dword ptr [esp + 8], 123 |
| 44 ; CHECK: mov dword ptr [esp + 16] | 44 ; CHECK: mov dword ptr [esp + 16] |
| 45 ; CHECK: mov dword ptr [esp + 12] | 45 ; CHECK: mov dword ptr [esp + 12] |
| 46 ; CHECK: call -4 | 46 ; CHECK: call -4 |
| 47 ; CALLTARGETS: call ignore64BitArgNoInline | 47 ; CALLTARGETS: .long ignore64BitArgNoInline |
| 48 ; CHECK: sub esp | 48 ; CHECK: sub esp |
| 49 ; CHECK: mov dword ptr [esp + 4] | 49 ; CHECK: mov dword ptr [esp + 4] |
| 50 ; CHECK: mov dword ptr [esp] | 50 ; CHECK: mov dword ptr [esp] |
| 51 ; CHECK: mov dword ptr [esp + 8], 123 | 51 ; CHECK: mov dword ptr [esp + 8], 123 |
| 52 ; CHECK: mov dword ptr [esp + 16] | 52 ; CHECK: mov dword ptr [esp + 16] |
| 53 ; CHECK: mov dword ptr [esp + 12] | 53 ; CHECK: mov dword ptr [esp + 12] |
| 54 ; CHECK: call -4 | 54 ; CHECK: call -4 |
| 55 ; CALLTARGETS: call ignore64BitArgNoInline | 55 ; CALLTARGETS: .long ignore64BitArgNoInline |
| 56 ; CHECK: sub esp | 56 ; CHECK: sub esp |
| 57 ; CHECK: mov dword ptr [esp + 4] | 57 ; CHECK: mov dword ptr [esp + 4] |
| 58 ; CHECK: mov dword ptr [esp] | 58 ; CHECK: mov dword ptr [esp] |
| 59 ; CHECK: mov dword ptr [esp + 8], 123 | 59 ; CHECK: mov dword ptr [esp + 8], 123 |
| 60 ; CHECK: mov dword ptr [esp + 16] | 60 ; CHECK: mov dword ptr [esp + 16] |
| 61 ; CHECK: mov dword ptr [esp + 12] | 61 ; CHECK: mov dword ptr [esp + 12] |
| 62 ; CHECK: call -4 | 62 ; CHECK: call -4 |
| 63 ; CALLTARGETS: call ignore64BitArgNoInline | 63 ; CALLTARGETS: .long ignore64BitArgNoInline |
| 64 ; | 64 ; |
| 65 ; OPTM1-LABEL: pass64BitArg | 65 ; OPTM1-LABEL: pass64BitArg |
| 66 ; OPTM1: sub esp | 66 ; OPTM1: sub esp |
| 67 ; OPTM1: mov dword ptr [esp + 4] | 67 ; OPTM1: mov dword ptr [esp + 4] |
| 68 ; OPTM1: mov dword ptr [esp] | 68 ; OPTM1: mov dword ptr [esp] |
| 69 ; OPTM1: mov dword ptr [esp + 8], 123 | 69 ; OPTM1: mov dword ptr [esp + 8], 123 |
| 70 ; OPTM1: mov dword ptr [esp + 16] | 70 ; OPTM1: mov dword ptr [esp + 16] |
| 71 ; OPTM1: mov dword ptr [esp + 12] | 71 ; OPTM1: mov dword ptr [esp + 12] |
| 72 ; OPTM1: call -4 | 72 ; OPTM1: call -4 |
| 73 ; OPTM1: sub esp | 73 ; OPTM1: sub esp |
| (...skipping 23 matching lines...) Expand all Loading... |
| 97 ; CHECK: sub esp | 97 ; CHECK: sub esp |
| 98 ; CHECK: mov dword ptr [esp + 4] | 98 ; CHECK: mov dword ptr [esp + 4] |
| 99 ; CHECK-NEXT: mov dword ptr [esp] | 99 ; CHECK-NEXT: mov dword ptr [esp] |
| 100 ; CHECK-NEXT: mov dword ptr [esp + 8], 123 | 100 ; CHECK-NEXT: mov dword ptr [esp + 8], 123 |
| 101 ; Bundle padding might be added (so not using -NEXT). | 101 ; Bundle padding might be added (so not using -NEXT). |
| 102 ; CHECK: mov dword ptr [esp + 16], 3735928559 | 102 ; CHECK: mov dword ptr [esp + 16], 3735928559 |
| 103 ; CHECK-NEXT: mov dword ptr [esp + 12], 305419896 | 103 ; CHECK-NEXT: mov dword ptr [esp + 12], 305419896 |
| 104 ; Bundle padding will push the call down. | 104 ; Bundle padding will push the call down. |
| 105 ; CHECK-NOT: mov | 105 ; CHECK-NOT: mov |
| 106 ; CHECK: call -4 | 106 ; CHECK: call -4 |
| 107 ; CALLTARGETS: call ignore64BitArgNoInline | 107 ; CALLTARGETS: .long ignore64BitArgNoInline |
| 108 ; | 108 ; |
| 109 ; OPTM1-LABEL: pass64BitConstArg | 109 ; OPTM1-LABEL: pass64BitConstArg |
| 110 ; OPTM1: sub esp | 110 ; OPTM1: sub esp |
| 111 ; OPTM1: mov dword ptr [esp + 4] | 111 ; OPTM1: mov dword ptr [esp + 4] |
| 112 ; OPTM1-NEXT: mov dword ptr [esp] | 112 ; OPTM1-NEXT: mov dword ptr [esp] |
| 113 ; OPTM1-NEXT: mov dword ptr [esp + 8], 123 | 113 ; OPTM1-NEXT: mov dword ptr [esp + 8], 123 |
| 114 ; Bundle padding might be added (so not using -NEXT). | 114 ; Bundle padding might be added (so not using -NEXT). |
| 115 ; OPTM1: mov dword ptr [esp + 16], 3735928559 | 115 ; OPTM1: mov dword ptr [esp + 16], 3735928559 |
| 116 ; OPTM1-NEXT: mov dword ptr [esp + 12], 305419896 | 116 ; OPTM1-NEXT: mov dword ptr [esp + 12], 305419896 |
| 117 ; OPTM1-NOT: mov | 117 ; OPTM1-NOT: mov |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 ; OPTM1: add | 232 ; OPTM1: add |
| 233 | 233 |
| 234 define internal i64 @div64BitSigned(i64 %a, i64 %b) { | 234 define internal i64 @div64BitSigned(i64 %a, i64 %b) { |
| 235 entry: | 235 entry: |
| 236 %div = sdiv i64 %a, %b | 236 %div = sdiv i64 %a, %b |
| 237 ret i64 %div | 237 ret i64 %div |
| 238 } | 238 } |
| 239 ; CHECK-LABEL: div64BitSigned | 239 ; CHECK-LABEL: div64BitSigned |
| 240 ; CALLTARGETS-LABEL: div64BitSigned | 240 ; CALLTARGETS-LABEL: div64BitSigned |
| 241 ; CHECK: call -4 | 241 ; CHECK: call -4 |
| 242 ; CALLTARGETS: call __divdi3 | 242 ; CALLTARGETS: .long __divdi3 |
| 243 | 243 |
| 244 ; OPTM1-LABEL: div64BitSigned | 244 ; OPTM1-LABEL: div64BitSigned |
| 245 ; OPTM1: call -4 | 245 ; OPTM1: call -4 |
| 246 | 246 |
| 247 define internal i64 @div64BitSignedConst(i64 %a) { | 247 define internal i64 @div64BitSignedConst(i64 %a) { |
| 248 entry: | 248 entry: |
| 249 %div = sdiv i64 %a, 12345678901234 | 249 %div = sdiv i64 %a, 12345678901234 |
| 250 ret i64 %div | 250 ret i64 %div |
| 251 } | 251 } |
| 252 ; CHECK-LABEL: div64BitSignedConst | 252 ; CHECK-LABEL: div64BitSignedConst |
| 253 ; CALLTARGETS-LABEL: div64BitSignedConst | 253 ; CALLTARGETS-LABEL: div64BitSignedConst |
| 254 ; CHECK: mov dword ptr [esp + 12], 2874 | 254 ; CHECK: mov dword ptr [esp + 12], 2874 |
| 255 ; CHECK: mov dword ptr [esp + 8], 1942892530 | 255 ; CHECK: mov dword ptr [esp + 8], 1942892530 |
| 256 ; CHECK: call -4 | 256 ; CHECK: call -4 |
| 257 ; CALLTARGETS: call __divdi3 | 257 ; CALLTARGETS: .long __divdi3 |
| 258 ; | 258 ; |
| 259 ; OPTM1-LABEL: div64BitSignedConst | 259 ; OPTM1-LABEL: div64BitSignedConst |
| 260 ; OPTM1: mov dword ptr [esp + 12], 2874 | 260 ; OPTM1: mov dword ptr [esp + 12], 2874 |
| 261 ; OPTM1: mov dword ptr [esp + 8], 1942892530 | 261 ; OPTM1: mov dword ptr [esp + 8], 1942892530 |
| 262 ; OPTM1: call -4 | 262 ; OPTM1: call -4 |
| 263 | 263 |
| 264 define internal i64 @div64BitUnsigned(i64 %a, i64 %b) { | 264 define internal i64 @div64BitUnsigned(i64 %a, i64 %b) { |
| 265 entry: | 265 entry: |
| 266 %div = udiv i64 %a, %b | 266 %div = udiv i64 %a, %b |
| 267 ret i64 %div | 267 ret i64 %div |
| 268 } | 268 } |
| 269 ; CHECK-LABEL: div64BitUnsigned | 269 ; CHECK-LABEL: div64BitUnsigned |
| 270 ; CALLTARGETS-LABEL: div64BitUnsigned | 270 ; CALLTARGETS-LABEL: div64BitUnsigned |
| 271 ; CHECK: call -4 | 271 ; CHECK: call -4 |
| 272 ; CALLTARGETS: call __udivdi3 | 272 ; CALLTARGETS: .long __udivdi3 |
| 273 ; | 273 ; |
| 274 ; OPTM1-LABEL: div64BitUnsigned | 274 ; OPTM1-LABEL: div64BitUnsigned |
| 275 ; OPTM1: call -4 | 275 ; OPTM1: call -4 |
| 276 | 276 |
| 277 define internal i64 @rem64BitSigned(i64 %a, i64 %b) { | 277 define internal i64 @rem64BitSigned(i64 %a, i64 %b) { |
| 278 entry: | 278 entry: |
| 279 %rem = srem i64 %a, %b | 279 %rem = srem i64 %a, %b |
| 280 ret i64 %rem | 280 ret i64 %rem |
| 281 } | 281 } |
| 282 ; CHECK-LABEL: rem64BitSigned | 282 ; CHECK-LABEL: rem64BitSigned |
| 283 ; CALLTARGETS-LABEL: rem64BitSigned | 283 ; CALLTARGETS-LABEL: rem64BitSigned |
| 284 ; CHECK: call -4 | 284 ; CHECK: call -4 |
| 285 ; CALLTARGETS: call __moddi3 | 285 ; CALLTARGETS: .long __moddi3 |
| 286 ; | 286 ; |
| 287 ; OPTM1-LABEL: rem64BitSigned | 287 ; OPTM1-LABEL: rem64BitSigned |
| 288 ; OPTM1: call -4 | 288 ; OPTM1: call -4 |
| 289 | 289 |
| 290 define internal i64 @rem64BitUnsigned(i64 %a, i64 %b) { | 290 define internal i64 @rem64BitUnsigned(i64 %a, i64 %b) { |
| 291 entry: | 291 entry: |
| 292 %rem = urem i64 %a, %b | 292 %rem = urem i64 %a, %b |
| 293 ret i64 %rem | 293 ret i64 %rem |
| 294 } | 294 } |
| 295 ; CHECK-LABEL: rem64BitUnsigned | 295 ; CHECK-LABEL: rem64BitUnsigned |
| 296 ; CALLTARGETS-LABEL: rem64BitUnsigned | 296 ; CALLTARGETS-LABEL: rem64BitUnsigned |
| 297 ; CHECK: call -4 | 297 ; CHECK: call -4 |
| 298 ; CALLTARGETS: call __umoddi3 | 298 ; CALLTARGETS: .long __umoddi3 |
| 299 ; | 299 ; |
| 300 ; OPTM1-LABEL: rem64BitUnsigned | 300 ; OPTM1-LABEL: rem64BitUnsigned |
| 301 ; OPTM1: call -4 | 301 ; OPTM1: call -4 |
| 302 | 302 |
| 303 define internal i64 @shl64BitSigned(i64 %a, i64 %b) { | 303 define internal i64 @shl64BitSigned(i64 %a, i64 %b) { |
| 304 entry: | 304 entry: |
| 305 %shl = shl i64 %a, %b | 305 %shl = shl i64 %a, %b |
| 306 ret i64 %shl | 306 ret i64 %shl |
| 307 } | 307 } |
| 308 ; CHECK-LABEL: shl64BitSigned | 308 ; CHECK-LABEL: shl64BitSigned |
| (...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1320 | 1320 |
| 1321 if.end3: ; preds = %if.then2, %if.end | 1321 if.end3: ; preds = %if.then2, %if.end |
| 1322 ret void | 1322 ret void |
| 1323 } | 1323 } |
| 1324 ; The following checks are not strictly necessary since one of the RUN | 1324 ; The following checks are not strictly necessary since one of the RUN |
| 1325 ; lines actually runs the output through the assembler. | 1325 ; lines actually runs the output through the assembler. |
| 1326 ; CHECK-LABEL: icmpLt64Imm | 1326 ; CHECK-LABEL: icmpLt64Imm |
| 1327 ; CHECK-NOT: cmp {{[0-9]+}}, | 1327 ; CHECK-NOT: cmp {{[0-9]+}}, |
| 1328 ; OPTM1-LABEL: icmpLt64Imm | 1328 ; OPTM1-LABEL: icmpLt64Imm |
| 1329 ; OPTM1-NOT: cmp {{[0-9]+}}, | 1329 ; OPTM1-NOT: cmp {{[0-9]+}}, |
| OLD | NEW |