Skip to content

Commit 8001dcb

Browse files
committed
[NFC][InstCombine] Add test coverage for (x ^ C) ^ y pattern
1 parent 5b78303 commit 8001dcb

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2+
; RUN: opt < %s -instcombine -S | FileCheck %s
3+
4+
declare i8 @gen8()
5+
declare void @use8(i8)
6+
7+
@a = global i8 17
8+
9+
define i8 @t0_scalar(i8 %x, i8 %y) {
10+
; CHECK-LABEL: @t0_scalar(
11+
; CHECK-NEXT: [[I0:%.*]] = xor i8 [[X:%.*]], 42
12+
; CHECK-NEXT: [[R:%.*]] = xor i8 [[I0]], [[Y:%.*]]
13+
; CHECK-NEXT: ret i8 [[R]]
14+
;
15+
%i0 = xor i8 %x, 42
16+
%r = xor i8 %i0, %y
17+
ret i8 %r
18+
}
19+
20+
define <2 x i8> @t1_splatvec(<2 x i8> %x, <2 x i8> %y) {
21+
; CHECK-LABEL: @t1_splatvec(
22+
; CHECK-NEXT: [[I0:%.*]] = xor <2 x i8> [[X:%.*]], <i8 42, i8 42>
23+
; CHECK-NEXT: [[R:%.*]] = xor <2 x i8> [[I0]], [[Y:%.*]]
24+
; CHECK-NEXT: ret <2 x i8> [[R]]
25+
;
26+
%i0 = xor <2 x i8> %x, <i8 42, i8 42>
27+
%r = xor <2 x i8> %i0, %y
28+
ret <2 x i8> %r
29+
}
30+
define <2 x i8> @t2_vec(<2 x i8> %x, <2 x i8> %y) {
31+
; CHECK-LABEL: @t2_vec(
32+
; CHECK-NEXT: [[I0:%.*]] = xor <2 x i8> [[X:%.*]], <i8 42, i8 24>
33+
; CHECK-NEXT: [[R:%.*]] = xor <2 x i8> [[I0]], [[Y:%.*]]
34+
; CHECK-NEXT: ret <2 x i8> [[R]]
35+
;
36+
%i0 = xor <2 x i8> %x, <i8 42, i8 24>
37+
%r = xor <2 x i8> %i0, %y
38+
ret <2 x i8> %r
39+
}
40+
define <2 x i8> @t3_vec_undef(<2 x i8> %x, <2 x i8> %y) {
41+
; CHECK-LABEL: @t3_vec_undef(
42+
; CHECK-NEXT: [[I0:%.*]] = xor <2 x i8> [[X:%.*]], <i8 42, i8 undef>
43+
; CHECK-NEXT: [[R:%.*]] = xor <2 x i8> [[I0]], [[Y:%.*]]
44+
; CHECK-NEXT: ret <2 x i8> [[R]]
45+
;
46+
%i0 = xor <2 x i8> %x, <i8 42, i8 undef>
47+
%r = xor <2 x i8> %i0, %y
48+
ret <2 x i8> %r
49+
}
50+
51+
define i8 @t4_extrause(i8 %x, i8 %y) {
52+
; CHECK-LABEL: @t4_extrause(
53+
; CHECK-NEXT: [[I0:%.*]] = xor i8 [[X:%.*]], 42
54+
; CHECK-NEXT: call void @use8(i8 [[I0]])
55+
; CHECK-NEXT: [[R:%.*]] = xor i8 [[I0]], [[Y:%.*]]
56+
; CHECK-NEXT: ret i8 [[R]]
57+
;
58+
%i0 = xor i8 %x, 42
59+
call void @use8(i8 %i0)
60+
%r = xor i8 %i0, %y
61+
ret i8 %r
62+
}
63+
64+
define i8 @t5_commutativity(i8 %x) {
65+
; CHECK-LABEL: @t5_commutativity(
66+
; CHECK-NEXT: [[I0:%.*]] = xor i8 [[X:%.*]], 42
67+
; CHECK-NEXT: [[Y:%.*]] = call i8 @gen8()
68+
; CHECK-NEXT: [[R:%.*]] = xor i8 [[Y]], [[I0]]
69+
; CHECK-NEXT: ret i8 [[R]]
70+
;
71+
%i0 = xor i8 %x, 42
72+
%y = call i8 @gen8()
73+
%r = xor i8 %y, %i0
74+
ret i8 %r
75+
}

0 commit comments

Comments
 (0)