OLD | NEW |
(Empty) | |
| 1 ; This is a regression test that idiv and div operands are legalized |
| 2 ; (they cannot be constants and can only be reg/mem for x86). |
| 3 |
| 4 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s |
| 5 ; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck %s |
| 6 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s |
| 7 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s |
| 8 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ |
| 9 ; RUN: | FileCheck --check-prefix=DUMP %s |
| 10 |
| 11 define i32 @Sdiv_const8_b(i8 %a) { |
| 12 ; CHECK-LABEL: Sdiv_const8_b |
| 13 entry: |
| 14 %div = sdiv i8 %a, 12 |
| 15 ; CHECK: mov {{.*}}, 12 |
| 16 ; CHECK-NOT: idiv 12 |
| 17 %div_ext = sext i8 %div to i32 |
| 18 ret i32 %div_ext |
| 19 } |
| 20 |
| 21 define i32 @Sdiv_const16_b(i16 %a) { |
| 22 ; CHECK-LABEL: Sdiv_const16_b |
| 23 entry: |
| 24 %div = sdiv i16 %a, 1234 |
| 25 ; CHECK: mov {{.*}}, 1234 |
| 26 ; CHECK-NOT: idiv 1234 |
| 27 %div_ext = sext i16 %div to i32 |
| 28 ret i32 %div_ext |
| 29 } |
| 30 |
| 31 define i32 @Sdiv_const32_b(i32 %a) { |
| 32 ; CHECK-LABEL: Sdiv_const32_b |
| 33 entry: |
| 34 %div = sdiv i32 %a, 1234 |
| 35 ; CHECK: mov {{.*}}, 1234 |
| 36 ; CHECK-NOT: idiv 1234 |
| 37 ret i32 %div |
| 38 } |
| 39 |
| 40 define i32 @Srem_const_b(i32 %a) { |
| 41 ; CHECK-LABEL: Srem_const_b |
| 42 entry: |
| 43 %rem = srem i32 %a, 2345 |
| 44 ; CHECK: mov {{.*}}, 2345 |
| 45 ; CHECK-NOT: idiv 2345 |
| 46 ret i32 %rem |
| 47 } |
| 48 |
| 49 define i32 @Udiv_const_b(i32 %a) { |
| 50 ; CHECK-LABEL: Udiv_const_b |
| 51 entry: |
| 52 %div = udiv i32 %a, 3456 |
| 53 ; CHECK: mov {{.*}}, 3456 |
| 54 ; CHECK-NOT: div 3456 |
| 55 ret i32 %div |
| 56 } |
| 57 |
| 58 define i32 @Urem_const_b(i32 %a) { |
| 59 ; CHECK-LABEL: Urem_const_b |
| 60 entry: |
| 61 %rem = urem i32 %a, 4567 |
| 62 ; CHECK: mov {{.*}}, 4567 |
| 63 ; CHECK-NOT: div 4567 |
| 64 ret i32 %rem |
| 65 } |
| 66 |
| 67 ; ERRORS-NOT: ICE translation error |
| 68 ; DUMP-NOT: SZ |
OLD | NEW |