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: xori 3, 3, 65535
46 ; CHECK-NEXT: xoris 3, 3, 32767
48 %c = icmp sgt i32 %a, -1
49 %s = select i1 %c, i64 2147483647, i64 -2147483648
55 define i8 @xori32i8(i32 %a) {
56 ; CHECK-LABEL: xori32i8:
58 ; CHECK-NEXT: srawi 3, 3, 31
59 ; CHECK-NEXT: xori 3, 3, 84
61 %shr4 = ashr i32 %a, 31
62 %conv5 = trunc i32 %shr4 to i8
63 %xor = xor i8 %conv5, 84
67 define i32 @selecti32i32(i32 %a) {
68 ; CHECK-LABEL: selecti32i32:
70 ; CHECK-NEXT: srawi 3, 3, 31
71 ; CHECK-NEXT: xori 3, 3, 84
73 %c = icmp sgt i32 %a, -1
74 %s = select i1 %c, i32 84, i32 -85
78 define i8 @selecti32i8(i32 %a) {
79 ; CHECK-LABEL: selecti32i8:
81 ; CHECK-NEXT: srawi 3, 3, 31
82 ; CHECK-NEXT: xori 3, 3, 84
84 %c = icmp sgt i32 %a, -1
85 %s = select i1 %c, i8 84, i8 -85
89 define i32 @selecti8i32(i8 %a) {
90 ; CHECK-LABEL: selecti8i32:
92 ; CHECK-NEXT: extsb 3, 3
93 ; CHECK-NEXT: srawi 3, 3, 7
94 ; CHECK-NEXT: xori 3, 3, 84
96 %c = icmp sgt i8 %a, -1
97 %s = select i1 %c, i32 84, i32 -85
101 define i32 @icmpasreq(i32 %input, i32 %a, i32 %b) {
102 ; CHECK-LABEL: icmpasreq:
104 ; CHECK-NEXT: cmpwi 3, 0
105 ; CHECK-NEXT: isellt 3, 4, 5
107 %sh = ashr i32 %input, 31
108 %c = icmp eq i32 %sh, -1
109 %s = select i1 %c, i32 %a, i32 %b
113 define i32 @icmpasrne(i32 %input, i32 %a, i32 %b) {
114 ; CHECK-LABEL: icmpasrne:
116 ; CHECK-NEXT: cmpwi 3, -1
117 ; CHECK-NEXT: iselgt 3, 4, 5
119 %sh = ashr i32 %input, 31
120 %c = icmp ne i32 %sh, -1
121 %s = select i1 %c, i32 %a, i32 %b
125 define i32 @oneusecmp(i32 %a, i32 %b, i32 %d) {
126 ; CHECK-LABEL: oneusecmp:
128 ; CHECK-NEXT: cmpwi 3, 0
129 ; CHECK-NEXT: srawi 6, 3, 31
130 ; CHECK-NEXT: xori 6, 6, 127
131 ; CHECK-NEXT: isellt 3, 5, 4
132 ; CHECK-NEXT: add 3, 6, 3
134 %c = icmp sle i32 %a, -1
135 %s = select i1 %c, i32 -128, i32 127
136 %s2 = select i1 %c, i32 %d, i32 %b