OLD | NEW |
1 ; This is a regression test that idiv and div operands are legalized | 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). | 2 ; (they cannot be constants and can only be reg/mem for x86). |
3 | 3 |
4 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 | FileCheck %s | 4 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 | FileCheck %s |
5 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -Om1 | FileCheck %s | 5 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -Om1 | FileCheck %s |
6 | 6 |
7 define internal i32 @Sdiv_const8_b(i8 %a) { | 7 define internal i32 @Sdiv_const8_b(i32 %a32) { |
8 ; CHECK-LABEL: Sdiv_const8_b | 8 ; CHECK-LABEL: Sdiv_const8_b |
9 entry: | 9 entry: |
| 10 %a = trunc i32 %a32 to i8 |
10 %div = sdiv i8 %a, 12 | 11 %div = sdiv i8 %a, 12 |
11 ; CHECK: mov {{.*}},0xc | 12 ; CHECK: mov {{.*}},0xc |
12 ; CHECK-NOT: idiv 0xc | 13 ; CHECK-NOT: idiv 0xc |
13 %div_ext = sext i8 %div to i32 | 14 %div_ext = sext i8 %div to i32 |
14 ret i32 %div_ext | 15 ret i32 %div_ext |
15 } | 16 } |
16 | 17 |
17 define internal i32 @Sdiv_const16_b(i16 %a) { | 18 define internal i32 @Sdiv_const16_b(i32 %a32) { |
18 ; CHECK-LABEL: Sdiv_const16_b | 19 ; CHECK-LABEL: Sdiv_const16_b |
19 entry: | 20 entry: |
| 21 %a = trunc i32 %a32 to i16 |
20 %div = sdiv i16 %a, 1234 | 22 %div = sdiv i16 %a, 1234 |
21 ; CHECK: mov {{.*}},0x4d2 | 23 ; CHECK: mov {{.*}},0x4d2 |
22 ; CHECK-NOT: idiv 0x4d2 | 24 ; CHECK-NOT: idiv 0x4d2 |
23 %div_ext = sext i16 %div to i32 | 25 %div_ext = sext i16 %div to i32 |
24 ret i32 %div_ext | 26 ret i32 %div_ext |
25 } | 27 } |
26 | 28 |
27 define internal i32 @Sdiv_const32_b(i32 %a) { | 29 define internal i32 @Sdiv_const32_b(i32 %a) { |
28 ; CHECK-LABEL: Sdiv_const32_b | 30 ; CHECK-LABEL: Sdiv_const32_b |
29 entry: | 31 entry: |
(...skipping 22 matching lines...) Expand all Loading... |
52 } | 54 } |
53 | 55 |
54 define internal i32 @Urem_const_b(i32 %a) { | 56 define internal i32 @Urem_const_b(i32 %a) { |
55 ; CHECK-LABEL: Urem_const_b | 57 ; CHECK-LABEL: Urem_const_b |
56 entry: | 58 entry: |
57 %rem = urem i32 %a, 4567 | 59 %rem = urem i32 %a, 4567 |
58 ; CHECK: mov {{.*}},0x11d7 | 60 ; CHECK: mov {{.*}},0x11d7 |
59 ; CHECK-NOT: div 0x11d7 | 61 ; CHECK-NOT: div 0x11d7 |
60 ret i32 %rem | 62 ret i32 %rem |
61 } | 63 } |
OLD | NEW |