| OLD | NEW |
| 1 ; This tries to be a comprehensive test of i8 operations. | 1 ; This tries to be a comprehensive test of i8 operations. |
| 2 | 2 |
| 3 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 \ | 3 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 \ |
| 4 ; RUN: -allow-externally-defined-symbols | FileCheck %s | 4 ; RUN: -allow-externally-defined-symbols | FileCheck %s |
| 5 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -Om1 \ | 5 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -Om1 \ |
| 6 ; RUN: -allow-externally-defined-symbols | FileCheck %s | 6 ; RUN: -allow-externally-defined-symbols | FileCheck %s |
| 7 | 7 |
| 8 ; The following tests i8 srem/urem lowering on x86-64, specifically that the %ah | 8 ; The following tests i8 srem/urem lowering on x86-64, specifically that the %ah |
| 9 ; result gets copied into %al/%bl/%cl/%dl before moved into its final register. | 9 ; result gets copied into %al/%bl/%cl/%dl before moved into its final register. |
| 10 ; This extra copy is forced by excluding al/bl/cl/dl by default (-reg-exclude), | 10 ; This extra copy is forced by excluding al/bl/cl/dl by default (-reg-exclude), |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 define internal i32 @add8BitConst(i32 %a) { | 42 define internal i32 @add8BitConst(i32 %a) { |
| 43 entry: | 43 entry: |
| 44 %a_8 = trunc i32 %a to i8 | 44 %a_8 = trunc i32 %a to i8 |
| 45 %add = add i8 %a_8, 123 | 45 %add = add i8 %a_8, 123 |
| 46 %ret = zext i8 %add to i32 | 46 %ret = zext i8 %add to i32 |
| 47 ret i32 %ret | 47 ret i32 %ret |
| 48 } | 48 } |
| 49 ; CHECK-LABEL: add8BitConst | 49 ; CHECK-LABEL: add8BitConst |
| 50 ; CHECK: add {{[abcd]l}} | 50 ; CHECK: add {{[abcd]l}} |
| 51 ; MIPS32-LABEL: add8BitConst | 51 ; MIPS32-LABEL: add8BitConst |
| 52 ; MIPS32: » li | 52 ; MIPS32: » addiu |
| 53 ; MIPS32: » addu | |
| 54 ; MIPS32: andi {{.*}},0xff | 53 ; MIPS32: andi {{.*}},0xff |
| 55 ; MIPS32: move | 54 ; MIPS32: move |
| 56 ; MIPS32: jr | 55 ; MIPS32: jr |
| 57 ; MIPS32: nop | 56 ; MIPS32: nop |
| 58 | 57 |
| 59 define internal i32 @sub8Bit(i32 %a, i32 %b) { | 58 define internal i32 @sub8Bit(i32 %a, i32 %b) { |
| 60 entry: | 59 entry: |
| 61 %a_8 = trunc i32 %a to i8 | 60 %a_8 = trunc i32 %a to i8 |
| 62 %b_8 = trunc i32 %b to i8 | 61 %b_8 = trunc i32 %b to i8 |
| 63 %sub = sub i8 %b_8, %a_8 | 62 %sub = sub i8 %b_8, %a_8 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 76 define internal i32 @sub8BitConst(i32 %a) { | 75 define internal i32 @sub8BitConst(i32 %a) { |
| 77 entry: | 76 entry: |
| 78 %a_8 = trunc i32 %a to i8 | 77 %a_8 = trunc i32 %a to i8 |
| 79 %sub = sub i8 %a_8, 123 | 78 %sub = sub i8 %a_8, 123 |
| 80 %ret = zext i8 %sub to i32 | 79 %ret = zext i8 %sub to i32 |
| 81 ret i32 %ret | 80 ret i32 %ret |
| 82 } | 81 } |
| 83 ; CHECK-LABEL: sub8BitConst | 82 ; CHECK-LABEL: sub8BitConst |
| 84 ; CHECK: sub {{[abcd]l}} | 83 ; CHECK: sub {{[abcd]l}} |
| 85 ; MIPS32-LABEL: sub8BitConst | 84 ; MIPS32-LABEL: sub8BitConst |
| 86 ; MIPS32: » li | 85 ; MIPS32: » addiu {{.*}},-123 |
| 87 ; MIPS32: » subu | |
| 88 ; MIPS32: andi {{.*}},0xff | 86 ; MIPS32: andi {{.*}},0xff |
| 89 ; MIPS32: move | 87 ; MIPS32: move |
| 90 ; MIPS32: jr | 88 ; MIPS32: jr |
| 91 ; MIPS32: nop | 89 ; MIPS32: nop |
| 92 | 90 |
| 93 define internal i32 @mul8Bit(i32 %a, i32 %b) { | 91 define internal i32 @mul8Bit(i32 %a, i32 %b) { |
| 94 entry: | 92 entry: |
| 95 %a_8 = trunc i32 %a to i8 | 93 %a_8 = trunc i32 %a to i8 |
| 96 %b_8 = trunc i32 %b to i8 | 94 %b_8 = trunc i32 %b to i8 |
| 97 %mul = mul i8 %b_8, %a_8 | 95 %mul = mul i8 %b_8, %a_8 |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 define internal i32 @shl8BitConst(i32 %a, i32 %b) { | 297 define internal i32 @shl8BitConst(i32 %a, i32 %b) { |
| 300 entry: | 298 entry: |
| 301 %a_8 = trunc i32 %a to i8 | 299 %a_8 = trunc i32 %a to i8 |
| 302 %shl = shl i8 %a_8, 6 | 300 %shl = shl i8 %a_8, 6 |
| 303 %ret = zext i8 %shl to i32 | 301 %ret = zext i8 %shl to i32 |
| 304 ret i32 %ret | 302 ret i32 %ret |
| 305 } | 303 } |
| 306 ; CHECK-LABEL: shl8BitConst | 304 ; CHECK-LABEL: shl8BitConst |
| 307 ; CHECK: shl {{[abcd]l|BYTE PTR}},0x6 | 305 ; CHECK: shl {{[abcd]l|BYTE PTR}},0x6 |
| 308 ; MIPS32-LABEL: shl8BitConst | 306 ; MIPS32-LABEL: shl8BitConst |
| 309 ; MIPS32: » li | 307 ; MIPS32: » sll |
| 310 ; MIPS32: » sllv | |
| 311 ; MIPS32: andi {{.*}},0xff | 308 ; MIPS32: andi {{.*}},0xff |
| 312 ; MIPS32: move | 309 ; MIPS32: move |
| 313 ; MIPS32: jr | 310 ; MIPS32: jr |
| 314 ; MIPS32: nop | 311 ; MIPS32: nop |
| 315 | 312 |
| 316 define internal i32 @lshr8Bit(i32 %a, i32 %b) { | 313 define internal i32 @lshr8Bit(i32 %a, i32 %b) { |
| 317 entry: | 314 entry: |
| 318 %a_8 = trunc i32 %a to i8 | 315 %a_8 = trunc i32 %a to i8 |
| 319 %b_8 = trunc i32 %b to i8 | 316 %b_8 = trunc i32 %b to i8 |
| 320 %lshr = lshr i8 %b_8, %a_8 | 317 %lshr = lshr i8 %b_8, %a_8 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 333 define internal i32 @lshr8BitConst(i32 %a, i32 %b) { | 330 define internal i32 @lshr8BitConst(i32 %a, i32 %b) { |
| 334 entry: | 331 entry: |
| 335 %a_8 = trunc i32 %a to i8 | 332 %a_8 = trunc i32 %a to i8 |
| 336 %lshr = lshr i8 %a_8, 6 | 333 %lshr = lshr i8 %a_8, 6 |
| 337 %ret = zext i8 %lshr to i32 | 334 %ret = zext i8 %lshr to i32 |
| 338 ret i32 %ret | 335 ret i32 %ret |
| 339 } | 336 } |
| 340 ; CHECK-LABEL: lshr8BitConst | 337 ; CHECK-LABEL: lshr8BitConst |
| 341 ; CHECK: shr {{[abcd]l|BYTE PTR}},0x6 | 338 ; CHECK: shr {{[abcd]l|BYTE PTR}},0x6 |
| 342 ; MIPS32-LABEL: lshr8BitConst | 339 ; MIPS32-LABEL: lshr8BitConst |
| 343 ; MIPS32: » li | 340 ; MIPS32: » srl |
| 344 ; MIPS32: » srlv | |
| 345 ; MIPS32: andi {{.*}},0xff | 341 ; MIPS32: andi {{.*}},0xff |
| 346 ; MIPS32: move | 342 ; MIPS32: move |
| 347 ; MIPS32: jr | 343 ; MIPS32: jr |
| 348 ; MIPS32: nop | 344 ; MIPS32: nop |
| 349 | 345 |
| 350 define internal i32 @ashr8Bit(i32 %a, i32 %b) { | 346 define internal i32 @ashr8Bit(i32 %a, i32 %b) { |
| 351 entry: | 347 entry: |
| 352 %a_8 = trunc i32 %a to i8 | 348 %a_8 = trunc i32 %a to i8 |
| 353 %b_8 = trunc i32 %b to i8 | 349 %b_8 = trunc i32 %b to i8 |
| 354 %ashr = ashr i8 %b_8, %a_8 | 350 %ashr = ashr i8 %b_8, %a_8 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 367 define internal i32 @ashr8BitConst(i32 %a, i32 %b) { | 363 define internal i32 @ashr8BitConst(i32 %a, i32 %b) { |
| 368 entry: | 364 entry: |
| 369 %a_8 = trunc i32 %a to i8 | 365 %a_8 = trunc i32 %a to i8 |
| 370 %ashr = ashr i8 %a_8, 6 | 366 %ashr = ashr i8 %a_8, 6 |
| 371 %ret = zext i8 %ashr to i32 | 367 %ret = zext i8 %ashr to i32 |
| 372 ret i32 %ret | 368 ret i32 %ret |
| 373 } | 369 } |
| 374 ; CHECK-LABEL: ashr8BitConst | 370 ; CHECK-LABEL: ashr8BitConst |
| 375 ; CHECK: sar {{[abcd]l|BYTE PTR}},0x6 | 371 ; CHECK: sar {{[abcd]l|BYTE PTR}},0x6 |
| 376 ; MIPS32-LABEL: ashr8BitConst | 372 ; MIPS32-LABEL: ashr8BitConst |
| 377 ; MIPS32: » li | 373 ; MIPS32: » sra |
| 378 ; MIPS32: » srav | |
| 379 ; MIPS32: andi {{.*}},0xff | 374 ; MIPS32: andi {{.*}},0xff |
| 380 ; MIPS32: move | 375 ; MIPS32: move |
| 381 ; MIPS32: jr | 376 ; MIPS32: jr |
| 382 ; MIPS32: nop | 377 ; MIPS32: nop |
| 383 | 378 |
| 384 define internal i32 @icmp8Bit(i32 %a, i32 %b) { | 379 define internal i32 @icmp8Bit(i32 %a, i32 %b) { |
| 385 entry: | 380 entry: |
| 386 %a_8 = trunc i32 %a to i8 | 381 %a_8 = trunc i32 %a to i8 |
| 387 %b_8 = trunc i32 %b to i8 | 382 %b_8 = trunc i32 %b to i8 |
| 388 %icmp = icmp ne i8 %b_8, %a_8 | 383 %icmp = icmp ne i8 %b_8, %a_8 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 %addr = inttoptr i32 %addr_arg to i8* | 565 %addr = inttoptr i32 %addr_arg to i8* |
| 571 %ret = load i8, i8* %addr, align 1 | 566 %ret = load i8, i8* %addr, align 1 |
| 572 %ret2 = sub i8 %ret, 0 | 567 %ret2 = sub i8 %ret, 0 |
| 573 %ret_ext = zext i8 %ret2 to i32 | 568 %ret_ext = zext i8 %ret2 to i32 |
| 574 ret i32 %ret_ext | 569 ret i32 %ret_ext |
| 575 } | 570 } |
| 576 ; CHECK-LABEL: load_i8 | 571 ; CHECK-LABEL: load_i8 |
| 577 ; CHECK: mov {{[a-d]l}},BYTE PTR | 572 ; CHECK: mov {{[a-d]l}},BYTE PTR |
| 578 ; MIPS32-LABEL: load_i8 | 573 ; MIPS32-LABEL: load_i8 |
| 579 ; MIPS32: lb | 574 ; MIPS32: lb |
| 580 ; MIPS32: » li | 575 ; MIPS32: » addiu» {{.*}},0 |
| 581 ; MIPS32: » subu | |
| 582 ; MIPS32: andi {{.*}},0xff | 576 ; MIPS32: andi {{.*}},0xff |
| 583 ; MIPS32: move | 577 ; MIPS32: move |
| 584 ; MIPS32: jr | 578 ; MIPS32: jr |
| 585 ; MIPS32: nop | 579 ; MIPS32: nop |
| 586 | 580 |
| 587 define i32 @load_i8_global(i32 %addr_arg) { | 581 define i32 @load_i8_global(i32 %addr_arg) { |
| 588 entry: | 582 entry: |
| 589 %addr = bitcast [1 x i8]* @global8 to i8* | 583 %addr = bitcast [1 x i8]* @global8 to i8* |
| 590 %ret = load i8, i8* %addr, align 1 | 584 %ret = load i8, i8* %addr, align 1 |
| 591 %ret2 = sub i8 %ret, 0 | 585 %ret2 = sub i8 %ret, 0 |
| 592 %ret_ext = zext i8 %ret2 to i32 | 586 %ret_ext = zext i8 %ret2 to i32 |
| 593 ret i32 %ret_ext | 587 ret i32 %ret_ext |
| 594 } | 588 } |
| 595 ; CHECK-LABEL: load_i8_global | 589 ; CHECK-LABEL: load_i8_global |
| 596 ; CHECK: mov {{[a-d]l}},{{(BYTE PTR)?}} | 590 ; CHECK: mov {{[a-d]l}},{{(BYTE PTR)?}} |
| 597 ; MIPS32-LABEL: load_i8_global | 591 ; MIPS32-LABEL: load_i8_global |
| 598 ; MIPS32: lui | 592 ; MIPS32: lui |
| 599 ; MIPS32: addiu | 593 ; MIPS32: addiu |
| 600 ; MIPS32: lb | 594 ; MIPS32: lb |
| 601 ; MIPS32: » li | 595 ; MIPS32: » addiu» {{.*}},0 |
| 602 ; MIPS32: » subu | |
| 603 ; MIPS32: andi {{.*}},0xff | 596 ; MIPS32: andi {{.*}},0xff |
| 604 ; MIPS32: jr | 597 ; MIPS32: jr |
| 605 ; MIPS32: nop | 598 ; MIPS32: nop |
| 606 | 599 |
| 607 define void @store_i8(i32 %addr_arg, i32 %val) { | 600 define void @store_i8(i32 %addr_arg, i32 %val) { |
| 608 entry: | 601 entry: |
| 609 %val_trunc = trunc i32 %val to i8 | 602 %val_trunc = trunc i32 %val to i8 |
| 610 %addr = inttoptr i32 %addr_arg to i8* | 603 %addr = inttoptr i32 %addr_arg to i8* |
| 611 store i8 %val_trunc, i8* %addr, align 1 | 604 store i8 %val_trunc, i8* %addr, align 1 |
| 612 ret void | 605 ret void |
| (...skipping 11 matching lines...) Expand all Loading... |
| 624 store i8 123, i8* %addr, align 1 | 617 store i8 123, i8* %addr, align 1 |
| 625 ret void | 618 ret void |
| 626 } | 619 } |
| 627 ; CHECK-LABEL: store_i8_const | 620 ; CHECK-LABEL: store_i8_const |
| 628 ; CHECK: mov BYTE PTR {{.*}},0x7b | 621 ; CHECK: mov BYTE PTR {{.*}},0x7b |
| 629 ; MIPS32-LABEL: store_i8_const | 622 ; MIPS32-LABEL: store_i8_const |
| 630 ; MIPS32: li | 623 ; MIPS32: li |
| 631 ; MIPS32: sb | 624 ; MIPS32: sb |
| 632 ; MIPS32: jr | 625 ; MIPS32: jr |
| 633 ; MIPS32: nop | 626 ; MIPS32: nop |
| OLD | NEW |