1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mcpu=pwr8 -mtriple=powerpc64-unknown-unknown %s -o - | FileCheck %s
4 define i32 @xori64i32(i64 %a) {
5 ; CHECK-LABEL: xori64i32:
7 ; CHECK-NEXT: sradi 3, 3, 63
8 ; CHECK-NEXT: xori 3, 3, 65535
9 ; CHECK-NEXT: xoris 3, 3, 32767
11 %shr4 = ashr i64 %a, 63
12 %conv5 = trunc i64 %shr4 to i32
13 %xor = xor i32 %conv5, 2147483647
17 define i64 @selecti64i64(i64 %a) {
18 ; CHECK-LABEL: selecti64i64:
20 ; CHECK-NEXT: sradi 3, 3, 63
21 ; CHECK-NEXT: xori 3, 3, 65535
22 ; CHECK-NEXT: xoris 3, 3, 32767
24 %c = icmp sgt i64 %a, -1
25 %s = select i1 %c, i64 2147483647, i64 -2147483648
29 define i32 @selecti64i32(i64 %a) {
30 ; CHECK-LABEL: selecti64i32:
32 ; CHECK-NEXT: sradi 3, 3, 63
33 ; CHECK-NEXT: xori 3, 3, 65535
34 ; CHECK-NEXT: xoris 3, 3, 32767
36 %c = icmp sgt i64 %a, -1
37 %s = select i1 %c, i32 2147483647, i32 -2147483648
41 define i64 @selecti32i64(i32 %a) {
42 ; CHECK-LABEL: selecti32i64:
44 ; CHECK-NEXT: srawi 3, 3, 31
45 ; CHECK-NEXT: extsw 3, 3
46 ; CHECK-NEXT: xori 3, 3, 65535
47 ; CHECK-NEXT: xoris 3, 3, 32767
49 %c = icmp sgt i32 %a, -1
50 %s = select i1 %c, i64 2147483647, i64 -2147483648
56 define i8 @xori32i8(i32 %a) {
57 ; CHECK-LABEL: xori32i8:
59 ; CHECK-NEXT: srawi 3, 3, 31
60 ; CHECK-NEXT: xori 3, 3, 84
62 %shr4 = ashr i32 %a, 31
63 %conv5 = trunc i32 %shr4 to i8
64 %xor = xor i8 %conv5, 84
68 define i32 @selecti32i32(i32 %a) {
69 ; CHECK-LABEL: selecti32i32:
71 ; CHECK-NEXT: srawi 3, 3, 31
72 ; CHECK-NEXT: extsw 3, 3
73 ; CHECK-NEXT: xori 3, 3, 84
75 %c = icmp sgt i32 %a, -1
76 %s = select i1 %c, i32 84, i32 -85
80 define i8 @selecti32i8(i32 %a) {
81 ; CHECK-LABEL: selecti32i8:
83 ; CHECK-NEXT: srawi 3, 3, 31
84 ; CHECK-NEXT: extsw 3, 3
85 ; CHECK-NEXT: xori 3, 3, 84
87 %c = icmp sgt i32 %a, -1
88 %s = select i1 %c, i8 84, i8 -85
92 define i32 @selecti8i32(i8 %a) {
93 ; CHECK-LABEL: selecti8i32:
95 ; CHECK-NEXT: extsb 3, 3
96 ; CHECK-NEXT: srawi 3, 3, 7
97 ; CHECK-NEXT: extsw 3, 3
98 ; CHECK-NEXT: xori 3, 3, 84
100 %c = icmp sgt i8 %a, -1
101 %s = select i1 %c, i32 84, i32 -85
105 define i32 @icmpasreq(i32 %input, i32 %a, i32 %b) {
106 ; CHECK-LABEL: icmpasreq:
108 ; CHECK-NEXT: cmpwi 3, 0
109 ; CHECK-NEXT: isellt 3, 4, 5
111 %sh = ashr i32 %input, 31
112 %c = icmp eq i32 %sh, -1
113 %s = select i1 %c, i32 %a, i32 %b
117 define i32 @icmpasrne(i32 %input, i32 %a, i32 %b) {
118 ; CHECK-LABEL: icmpasrne:
120 ; CHECK-NEXT: cmpwi 3, -1
121 ; CHECK-NEXT: iselgt 3, 4, 5
123 %sh = ashr i32 %input, 31
124 %c = icmp ne i32 %sh, -1
125 %s = select i1 %c, i32 %a, i32 %b
129 define i32 @oneusecmp(i32 %a, i32 %b, i32 %d) {
130 ; CHECK-LABEL: oneusecmp:
132 ; CHECK-NEXT: srawi 6, 3, 31
133 ; CHECK-NEXT: cmpwi 3, 0
134 ; CHECK-NEXT: xori 3, 6, 127
135 ; CHECK-NEXT: isellt 4, 5, 4
136 ; CHECK-NEXT: add 3, 3, 4
138 %c = icmp sle i32 %a, -1
139 %s = select i1 %c, i32 -128, i32 127
140 %s2 = select i1 %c, i32 %d, i32 %b