Skip to content

Commit 41f8b6f

Browse files
committed
[GlobalIsel][X86] Regenerate G_MUL scalar legalization tests
Add i8 test coverage
1 parent d072d11 commit 41f8b6f

File tree

1 file changed

+62
-28
lines changed

1 file changed

+62
-28
lines changed

llvm/test/CodeGen/X86/GlobalISel/legalize-mul-scalar.mir

Lines changed: 62 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
# RUN: llc -O0 -mtriple=x86_64-linux-gnu -run-pass=legalizer %s -o - | FileCheck %s
33

44
--- |
5-
define void @test_mul_i1() { ret void}
5+
define void @test_mul_i1() { ret void }
6+
7+
define i8 @test_mul_i8(i8 %arg1, i8 %arg2) {
8+
%ret = mul i8 %arg1, %arg2
9+
ret i8 %ret
10+
}
611

712
define i16 @test_mul_i16(i16 %arg1, i16 %arg2) {
813
%ret = mul i16 %arg1, %arg2
@@ -18,7 +23,6 @@
1823
%ret = mul i64 %arg1, %arg2
1924
ret i64 %ret
2025
}
21-
2226
...
2327
---
2428
name: test_mul_i1
@@ -34,14 +38,14 @@ body: |
3438
3539
; CHECK-LABEL: name: test_mul_i1
3640
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edx
37-
; CHECK: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s32)
38-
; CHECK: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s32)
39-
; CHECK: [[MUL:%[0-9]+]]:_(s8) = G_MUL [[TRUNC]], [[TRUNC1]]
40-
; CHECK: [[DEF:%[0-9]+]]:_(p0) = G_IMPLICIT_DEF
41-
; CHECK: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 1
42-
; CHECK: [[AND:%[0-9]+]]:_(s8) = G_AND [[MUL]], [[C]]
43-
; CHECK: G_STORE [[AND]](s8), [[DEF]](p0) :: (store (s1))
44-
; CHECK: RET 0
41+
; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s32)
42+
; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s32)
43+
; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s8) = G_MUL [[TRUNC]], [[TRUNC1]]
44+
; CHECK-NEXT: [[DEF:%[0-9]+]]:_(p0) = G_IMPLICIT_DEF
45+
; CHECK-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 1
46+
; CHECK-NEXT: [[AND:%[0-9]+]]:_(s8) = G_AND [[MUL]], [[C]]
47+
; CHECK-NEXT: G_STORE [[AND]](s8), [[DEF]](p0) :: (store (s1))
48+
; CHECK-NEXT: RET 0
4549
%0(s32) = COPY $edx
4650
%1(s1) = G_TRUNC %0(s32)
4751
%2(s1) = G_MUL %1, %1
@@ -50,6 +54,33 @@ body: |
5054
RET 0
5155
...
5256
---
57+
name: test_mul_i8
58+
alignment: 16
59+
legalized: false
60+
regBankSelected: false
61+
registers:
62+
- { id: 0, class: _ }
63+
- { id: 1, class: _ }
64+
- { id: 2, class: _ }
65+
body: |
66+
bb.1 (%ir-block.0):
67+
liveins: $edi, $esi
68+
69+
; CHECK-LABEL: name: test_mul_i8
70+
; CHECK: liveins: $edi, $esi
71+
; CHECK-NEXT: {{ $}}
72+
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s8) = COPY $dl
73+
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s8) = COPY $sil
74+
; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s8) = G_MUL [[COPY]], [[COPY1]]
75+
; CHECK-NEXT: $al = COPY [[MUL]](s8)
76+
; CHECK-NEXT: RET 0, implicit $al
77+
%0(s8) = COPY $dl
78+
%1(s8) = COPY $sil
79+
%2(s8) = G_MUL %0, %1
80+
$al = COPY %2(s8)
81+
RET 0, implicit $al
82+
...
83+
---
5384
name: test_mul_i16
5485
alignment: 16
5586
legalized: false
@@ -63,17 +94,18 @@ body: |
6394
liveins: $edi, $esi
6495
6596
; CHECK-LABEL: name: test_mul_i16
66-
; CHECK: [[COPY:%[0-9]+]]:_(s16) = COPY $di
67-
; CHECK: [[COPY1:%[0-9]+]]:_(s16) = COPY $si
68-
; CHECK: [[MUL:%[0-9]+]]:_(s16) = G_MUL [[COPY]], [[COPY1]]
69-
; CHECK: $ax = COPY [[MUL]](s16)
70-
; CHECK: RET 0, implicit $ax
97+
; CHECK: liveins: $edi, $esi
98+
; CHECK-NEXT: {{ $}}
99+
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s16) = COPY $di
100+
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s16) = COPY $si
101+
; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s16) = G_MUL [[COPY]], [[COPY1]]
102+
; CHECK-NEXT: $ax = COPY [[MUL]](s16)
103+
; CHECK-NEXT: RET 0, implicit $ax
71104
%0(s16) = COPY $di
72105
%1(s16) = COPY $si
73106
%2(s16) = G_MUL %0, %1
74107
$ax = COPY %2(s16)
75108
RET 0, implicit $ax
76-
77109
...
78110
---
79111
name: test_mul_i32
@@ -89,17 +121,18 @@ body: |
89121
liveins: $edi, $esi
90122
91123
; CHECK-LABEL: name: test_mul_i32
92-
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
93-
; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $esi
94-
; CHECK: [[MUL:%[0-9]+]]:_(s32) = G_MUL [[COPY]], [[COPY1]]
95-
; CHECK: $eax = COPY [[MUL]](s32)
96-
; CHECK: RET 0, implicit $eax
124+
; CHECK: liveins: $edi, $esi
125+
; CHECK-NEXT: {{ $}}
126+
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
127+
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $esi
128+
; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s32) = G_MUL [[COPY]], [[COPY1]]
129+
; CHECK-NEXT: $eax = COPY [[MUL]](s32)
130+
; CHECK-NEXT: RET 0, implicit $eax
97131
%0(s32) = COPY $edi
98132
%1(s32) = COPY $esi
99133
%2(s32) = G_MUL %0, %1
100134
$eax = COPY %2(s32)
101135
RET 0, implicit $eax
102-
103136
...
104137
---
105138
name: test_mul_i64
@@ -115,15 +148,16 @@ body: |
115148
liveins: $rdi, $rsi
116149
117150
; CHECK-LABEL: name: test_mul_i64
118-
; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $rdi
119-
; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $rsi
120-
; CHECK: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[COPY]], [[COPY1]]
121-
; CHECK: $rax = COPY [[MUL]](s64)
122-
; CHECK: RET 0, implicit $rax
151+
; CHECK: liveins: $rdi, $rsi
152+
; CHECK-NEXT: {{ $}}
153+
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $rdi
154+
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $rsi
155+
; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[COPY]], [[COPY1]]
156+
; CHECK-NEXT: $rax = COPY [[MUL]](s64)
157+
; CHECK-NEXT: RET 0, implicit $rax
123158
%0(s64) = COPY $rdi
124159
%1(s64) = COPY $rsi
125160
%2(s64) = G_MUL %0, %1
126161
$rax = COPY %2(s64)
127162
RET 0, implicit $rax
128-
129163
...

0 commit comments

Comments
 (0)