1# RUN: llvm-mc -triple hexagon -disassemble < %s | FileCheck %s
2# Hexagon Programmer's Reference Manual 11.1.3 ALU32/PRED
3
4# Conditional add
50xf1 0xc3 0x75 0x74
6# CHECK: if (p3) r17 = add(r21, #31)
70x03 0x40 0x45 0x85 0xf1 0xe3 0x75 0x74
8# CHECK: p3 = r5
9# CHECK-NEXT: if (p3.new) r17 = add(r21, #31)
100xf1 0xc3 0xf5 0x74
11# CHECK: if (!p3) r17 = add(r21, #31)
120x03 0x40 0x45 0x85 0xf1 0xe3 0xf5 0x74
13# CHECK: p3 = r5
14# CHECK-NEXT: if (!p3.new) r17 = add(r21, #31)
150x71 0xdf 0x15 0xfb
16# CHECK: if (p3) r17 = add(r21, r31)
170x03 0x40 0x45 0x85 0x71 0xff 0x15 0xfb
18# CHECK: p3 = r5
19# CHECK-NEXT: if (p3.new) r17 = add(r21, r31)
200xf1 0xdf 0x15 0xfb
21# CHECK: if (!p3) r17 = add(r21, r31)
220x03 0x40 0x45 0x85 0xf1 0xff 0x15 0xfb
23# CHECK: p3 = r5
24# CHECK-NEXT: if (!p3.new) r17 = add(r21, r31)
25
26# Conditional shift halfword
270x11 0xe3 0x15 0x70
28# CHECK: if (p3) r17 = aslh(r21)
290x03 0x40 0x45 0x85 0x11 0xe7 0x15 0x70
30# CHECK: p3 = r5
31# CHECK-NEXT: if (p3.new) r17 = aslh(r21)
320x11 0xeb 0x15 0x70
33# CHECK: if (!p3) r17 = aslh(r21)
340x03 0x40 0x45 0x85 0x11 0xef 0x15 0x70
35# CHECK: p3 = r5
36# CHECK-NEXT: if (!p3.new) r17 = aslh(r21)
370x11 0xe3 0x35 0x70
38# CHECK: if (p3) r17 = asrh(r21)
390x03 0x40 0x45 0x85 0x11 0xe7 0x35 0x70
40# CHECK: p3 = r5
41# CHECK-NEXT: if (p3.new) r17 = asrh(r21)
420x11 0xeb 0x35 0x70
43# CHECK: if (!p3) r17 = asrh(r21)
440x03 0x40 0x45 0x85 0x11 0xef 0x35 0x70
45# CHECK: p3 = r5
46# CHECK-NEXT: if (!p3.new) r17 = asrh(r21)
47
48# Conditional combine
490x70 0xdf 0x15 0xfd
50# CHECK: if (p3) r17:16 = combine(r21, r31)
510xf0 0xdf 0x15 0xfd
52# CHECK: if (!p3) r17:16 = combine(r21, r31)
530x03 0x40 0x45 0x85 0x70 0xff 0x15 0xfd
54# CHECK: p3 = r5
55# CHECK-NEXT: if (p3.new) r17:16 = combine(r21, r31)
560x03 0x40 0x45 0x85 0xf0 0xff 0x15 0xfd
57# CHECK: p3 = r5
58# CHECK-NEXT: if (!p3.new) r17:16 = combine(r21, r31)
59
60# Conditional logical operations
610x71 0xdf 0x15 0xf9
62# CHECK: if (p3) r17 = and(r21, r31)
630xf1 0xdf 0x15 0xf9
64# CHECK: if (!p3) r17 = and(r21, r31)
650x03 0x40 0x45 0x85 0x71 0xff 0x15 0xf9
66# CHECK: p3 = r5
67# CHECK-NEXT: if (p3.new) r17 = and(r21, r31)
680x03 0x40 0x45 0x85 0xf1 0xff 0x15 0xf9
69# CHECK: p3 = r5
70# CHECK-NEXT: if (!p3.new) r17 = and(r21, r31)
710x71 0xdf 0x35 0xf9
72# CHECK: if (p3) r17 = or(r21, r31)
730xf1 0xdf 0x35 0xf9
74# CHECK: if (!p3) r17 = or(r21, r31)
750x03 0x40 0x45 0x85 0x71 0xff 0x35 0xf9
76# CHECK: p3 = r5
77# CHECK-NEXT: if (p3.new) r17 = or(r21, r31)
780x03 0x40 0x45 0x85 0xf1 0xff 0x35 0xf9
79# CHECK: p3 = r5
80# CHECK-NEXT: if (!p3.new) r17 = or(r21, r31)
810x71 0xdf 0x75 0xf9
82# CHECK: if (p3) r17 = xor(r21, r31)
830xf1 0xdf 0x75 0xf9
84# CHECK: if (!p3) r17 = xor(r21, r31)
850x03 0x40 0x45 0x85 0x71 0xff 0x75 0xf9
86# CHECK: p3 = r5
87# CHECK-NEXT: if (p3.new) r17 = xor(r21, r31)
880x03 0x40 0x45 0x85 0xf1 0xff 0x75 0xf9
89# CHECK: p3 = r5
90# CHECK-NEXT: if (!p3.new) r17 = xor(r21, r31)
91
92# Conditional subtract
930x71 0xdf 0x35 0xfb
94# CHECK: if (p3) r17 = sub(r31, r21)
950xf1 0xdf 0x35 0xfb
96# CHECK: if (!p3) r17 = sub(r31, r21)
970x03 0x40 0x45 0x85 0x71 0xff 0x35 0xfb
98# CHECK: p3 = r5
99# CHECK-NEXT: if (p3.new) r17 = sub(r31, r21)
1000x03 0x40 0x45 0x85 0xf1 0xff 0x35 0xfb
101# CHECK: p3 = r5
102# CHECK-NEXT: if (!p3.new) r17 = sub(r31, r21)
103
104# Conditional sign extend
1050x11 0xe3 0xb5 0x70
106# CHECK: if (p3) r17 = sxtb(r21)
1070x11 0xeb 0xb5 0x70
108# CHECK: if (!p3) r17 = sxtb(r21)
1090x03 0x40 0x45 0x85 0x11 0xe7 0xb5 0x70
110# CHECK: p3 = r5
111# CHECK-NEXT: if (p3.new) r17 = sxtb(r21)
1120x03 0x40 0x45 0x85 0x11 0xef 0xb5 0x70
113# CHECK: p3 = r5
114# CHECK-NEXT: if (!p3.new) r17 = sxtb(r21)
1150x11 0xe3 0xf5 0x70
116# CHECK: if (p3) r17 = sxth(r21)
1170x11 0xeb 0xf5 0x70
118# CHECK: if (!p3) r17 = sxth(r21)
1190x03 0x40 0x45 0x85 0x11 0xe7 0xf5 0x70
120# CHECK: p3 = r5
121# CHECK-NEXT: if (p3.new) r17 = sxth(r21)
1220x03 0x40 0x45 0x85 0x11 0xef 0xf5 0x70
123# CHECK: p3 = r5
124# CHECK-NEXT: if (!p3.new) r17 = sxth(r21)
125
126# Conditional transfer
1270xb1 0xc2 0x60 0x7e
128# CHECK: if (p3) r17 = #21
1290xb1 0xc2 0xe0 0x7e
130# CHECK: if (!p3) r17 = #21
1310x03 0x40 0x45 0x85 0xb1 0xe2 0x60 0x7e
132# CHECK: p3 = r5
133# CHECK-NEXT: if (p3.new) r17 = #21
1340x03 0x40 0x45 0x85 0xb1 0xe2 0xe0 0x7e
135# CHECK: p3 = r5
136# CHECK-NEXT: if (!p3.new) r17 = #21
137
138# Conditional zero extend
1390x11 0xe3 0x95 0x70
140# CHECK: if (p3) r17 = zxtb(r21)
1410x11 0xeb 0x95 0x70
142# CHECK: if (!p3) r17 = zxtb(r21)
1430x03 0x40 0x45 0x85 0x11 0xe7 0x95 0x70
144# CHECK: p3 = r5
145# CHECK-NEXT: if (p3.new) r17 = zxtb(r21)
1460x03 0x40 0x45 0x85 0x11 0xef 0x95 0x70
147# CHECK: p3 = r5
148# CHECK-NEXT: if (!p3.new) r17 = zxtb(r21)
1490x11 0xe3 0xd5 0x70
150# CHECK: if (p3) r17 = zxth(r21)
1510x11 0xeb 0xd5 0x70
152# CHECK: if (!p3) r17 = zxth(r21)
1530x03 0x40 0x45 0x85 0x11 0xe7 0xd5 0x70
154# CHECK: p3 = r5
155# CHECK-NEXT: if (p3.new) r17 = zxth(r21)
1560x03 0x40 0x45 0x85 0x11 0xef 0xd5 0x70
157# CHECK: p3 = r5
158# CHECK-NEXT: if (!p3.new) r17 = zxth(r21)
159
160# Compare
1610xe3 0xc3 0x15 0x75
162# CHECK: p3 = cmp.eq(r21, #31)
1630xf3 0xc3 0x15 0x75
164# CHECK: p3 = !cmp.eq(r21, #31)
1650xe3 0xc3 0x55 0x75
166# CHECK: p3 = cmp.gt(r21, #31)
1670xf3 0xc3 0x55 0x75
168# CHECK: p3 = !cmp.gt(r21, #31)
1690xe3 0xc3 0x95 0x75
170# CHECK: p3 = cmp.gtu(r21, #31)
1710xf3 0xc3 0x95 0x75
172# CHECK: p3 = !cmp.gtu(r21, #31)
1730x03 0xdf 0x15 0xf2
174# CHECK: p3 = cmp.eq(r21, r31)
1750x13 0xdf 0x15 0xf2
176# CHECK: p3 = !cmp.eq(r21, r31)
1770x03 0xdf 0x55 0xf2
178# CHECK: p3 = cmp.gt(r21, r31)
1790x13 0xdf 0x55 0xf2
180# CHECK: p3 = !cmp.gt(r21, r31)
1810x03 0xdf 0x75 0xf2
182# CHECK: p3 = cmp.gtu(r21, r31)
1830x13 0xdf 0x75 0xf2
184# CHECK: p3 = !cmp.gtu(r21, r31)
185
186# Compare to general register
1870xf1 0xe3 0x55 0x73
188# CHECK: r17 = cmp.eq(r21, #31)
1890xf1 0xe3 0x75 0x73
190# CHECK: r17 = !cmp.eq(r21, #31)
1910x11 0xdf 0x55 0xf3
192# CHECK: r17 = cmp.eq(r21, r31)
1930x11 0xdf 0x75 0xf3
194# CHECK: r17 = !cmp.eq(r21, r31)
195