@@ -2102,12 +2102,9 @@ define i1 @bitwise_and_logical_and_masked_icmp_allones_poison2(i1 %c, i32 %x, i3
2102
2102
2103
2103
define i1 @samesign (i32 %x , i32 %y ) {
2104
2104
; CHECK-LABEL: @samesign(
2105
- ; CHECK-NEXT: [[A:%.*]] = and i32 [[X:%.*]], [[Y:%.*]]
2106
- ; CHECK-NEXT: [[LT:%.*]] = icmp slt i32 [[A]], 0
2107
- ; CHECK-NEXT: [[O:%.*]] = or i32 [[X]], [[Y]]
2108
- ; CHECK-NEXT: [[GT:%.*]] = icmp sgt i32 [[O]], -1
2109
- ; CHECK-NEXT: [[R:%.*]] = or i1 [[LT]], [[GT]]
2110
- ; CHECK-NEXT: ret i1 [[R]]
2105
+ ; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[X:%.*]], [[Y:%.*]]
2106
+ ; CHECK-NEXT: [[TMP2:%.*]] = icmp sgt i32 [[TMP1]], -1
2107
+ ; CHECK-NEXT: ret i1 [[TMP2]]
2111
2108
;
2112
2109
%a = and i32 %x , %y
2113
2110
%lt = icmp slt i32 %a , 0
@@ -2119,12 +2116,9 @@ define i1 @samesign(i32 %x, i32 %y) {
2119
2116
2120
2117
define <2 x i1 > @samesign_different_sign_bittest1 (<2 x i32 > %x , <2 x i32 > %y ) {
2121
2118
; CHECK-LABEL: @samesign_different_sign_bittest1(
2122
- ; CHECK-NEXT: [[A:%.*]] = and <2 x i32> [[X:%.*]], [[Y:%.*]]
2123
- ; CHECK-NEXT: [[LT:%.*]] = icmp slt <2 x i32> [[A]], zeroinitializer
2124
- ; CHECK-NEXT: [[O:%.*]] = or <2 x i32> [[X]], [[Y]]
2125
- ; CHECK-NEXT: [[GT:%.*]] = icmp sgt <2 x i32> [[O]], <i32 -1, i32 -1>
2126
- ; CHECK-NEXT: [[R:%.*]] = or <2 x i1> [[LT]], [[GT]]
2127
- ; CHECK-NEXT: ret <2 x i1> [[R]]
2119
+ ; CHECK-NEXT: [[TMP1:%.*]] = xor <2 x i32> [[X:%.*]], [[Y:%.*]]
2120
+ ; CHECK-NEXT: [[TMP2:%.*]] = icmp sgt <2 x i32> [[TMP1]], <i32 -1, i32 -1>
2121
+ ; CHECK-NEXT: ret <2 x i1> [[TMP2]]
2128
2122
;
2129
2123
%a = and <2 x i32 > %x , %y
2130
2124
%lt = icmp sle <2 x i32 > %a , <i32 -1 , i32 -1 >
@@ -2136,12 +2130,9 @@ define <2 x i1> @samesign_different_sign_bittest1(<2 x i32> %x, <2 x i32> %y) {
2136
2130
2137
2131
define i1 @samesign_different_sign_bittest2 (i32 %x , i32 %y ) {
2138
2132
; CHECK-LABEL: @samesign_different_sign_bittest2(
2139
- ; CHECK-NEXT: [[A:%.*]] = and i32 [[X:%.*]], [[Y:%.*]]
2140
- ; CHECK-NEXT: [[LT:%.*]] = icmp slt i32 [[A]], 0
2141
- ; CHECK-NEXT: [[O:%.*]] = or i32 [[X]], [[Y]]
2142
- ; CHECK-NEXT: [[GT:%.*]] = icmp sgt i32 [[O]], -1
2143
- ; CHECK-NEXT: [[R:%.*]] = or i1 [[LT]], [[GT]]
2144
- ; CHECK-NEXT: ret i1 [[R]]
2133
+ ; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[X:%.*]], [[Y:%.*]]
2134
+ ; CHECK-NEXT: [[TMP2:%.*]] = icmp sgt i32 [[TMP1]], -1
2135
+ ; CHECK-NEXT: ret i1 [[TMP2]]
2145
2136
;
2146
2137
%a = and i32 %x , %y
2147
2138
%lt = icmp slt i32 %a , 0
@@ -2153,12 +2144,9 @@ define i1 @samesign_different_sign_bittest2(i32 %x, i32 %y) {
2153
2144
2154
2145
define i1 @samesign_commute1 (i32 %x , i32 %y ) {
2155
2146
; CHECK-LABEL: @samesign_commute1(
2156
- ; CHECK-NEXT: [[A:%.*]] = and i32 [[X:%.*]], [[Y:%.*]]
2157
- ; CHECK-NEXT: [[LT:%.*]] = icmp slt i32 [[A]], 0
2158
- ; CHECK-NEXT: [[O:%.*]] = or i32 [[X]], [[Y]]
2159
- ; CHECK-NEXT: [[GT:%.*]] = icmp sgt i32 [[O]], -1
2160
- ; CHECK-NEXT: [[R:%.*]] = or i1 [[GT]], [[LT]]
2161
- ; CHECK-NEXT: ret i1 [[R]]
2147
+ ; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[X:%.*]], [[Y:%.*]]
2148
+ ; CHECK-NEXT: [[TMP2:%.*]] = icmp sgt i32 [[TMP1]], -1
2149
+ ; CHECK-NEXT: ret i1 [[TMP2]]
2162
2150
;
2163
2151
%a = and i32 %x , %y
2164
2152
%lt = icmp slt i32 %a , 0
@@ -2170,12 +2158,9 @@ define i1 @samesign_commute1(i32 %x, i32 %y) {
2170
2158
2171
2159
define i1 @samesign_commute2 (i32 %x , i32 %y ) {
2172
2160
; CHECK-LABEL: @samesign_commute2(
2173
- ; CHECK-NEXT: [[A:%.*]] = and i32 [[X:%.*]], [[Y:%.*]]
2174
- ; CHECK-NEXT: [[LT:%.*]] = icmp slt i32 [[A]], 0
2175
- ; CHECK-NEXT: [[O:%.*]] = or i32 [[Y]], [[X]]
2176
- ; CHECK-NEXT: [[GT:%.*]] = icmp sgt i32 [[O]], -1
2177
- ; CHECK-NEXT: [[R:%.*]] = or i1 [[LT]], [[GT]]
2178
- ; CHECK-NEXT: ret i1 [[R]]
2161
+ ; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[X:%.*]], [[Y:%.*]]
2162
+ ; CHECK-NEXT: [[TMP2:%.*]] = icmp sgt i32 [[TMP1]], -1
2163
+ ; CHECK-NEXT: ret i1 [[TMP2]]
2179
2164
;
2180
2165
%a = and i32 %x , %y
2181
2166
%lt = icmp slt i32 %a , 0
@@ -2187,12 +2172,9 @@ define i1 @samesign_commute2(i32 %x, i32 %y) {
2187
2172
2188
2173
define i1 @samesign_commute3 (i32 %x , i32 %y ) {
2189
2174
; CHECK-LABEL: @samesign_commute3(
2190
- ; CHECK-NEXT: [[A:%.*]] = and i32 [[X:%.*]], [[Y:%.*]]
2191
- ; CHECK-NEXT: [[LT:%.*]] = icmp slt i32 [[A]], 0
2192
- ; CHECK-NEXT: [[O:%.*]] = or i32 [[Y]], [[X]]
2193
- ; CHECK-NEXT: [[GT:%.*]] = icmp sgt i32 [[O]], -1
2194
- ; CHECK-NEXT: [[R:%.*]] = or i1 [[GT]], [[LT]]
2195
- ; CHECK-NEXT: ret i1 [[R]]
2175
+ ; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[Y:%.*]], [[X:%.*]]
2176
+ ; CHECK-NEXT: [[TMP2:%.*]] = icmp sgt i32 [[TMP1]], -1
2177
+ ; CHECK-NEXT: ret i1 [[TMP2]]
2196
2178
;
2197
2179
%a = and i32 %x , %y
2198
2180
%lt = icmp slt i32 %a , 0
@@ -2240,12 +2222,11 @@ define i1 @samesign_mult_use(i32 %x, i32 %y) {
2240
2222
; CHECK-LABEL: @samesign_mult_use(
2241
2223
; CHECK-NEXT: [[A:%.*]] = and i32 [[X:%.*]], [[Y:%.*]]
2242
2224
; CHECK-NEXT: call void @use32(i32 [[A]])
2243
- ; CHECK-NEXT: [[LT:%.*]] = icmp slt i32 [[A]], 0
2244
2225
; CHECK-NEXT: [[O:%.*]] = or i32 [[X]], [[Y]]
2245
2226
; CHECK-NEXT: call void @use32(i32 [[O]])
2246
- ; CHECK-NEXT: [[GT :%.*]] = icmp sgt i32 [[O ]], -1
2247
- ; CHECK-NEXT: [[R :%.*]] = or i1 [[LT ]], [[GT]]
2248
- ; CHECK-NEXT: ret i1 [[R ]]
2227
+ ; CHECK-NEXT: [[TMP1 :%.*]] = xor i32 [[X ]], [[Y]]
2228
+ ; CHECK-NEXT: [[TMP2 :%.*]] = icmp sgt i32 [[TMP1 ]], -1
2229
+ ; CHECK-NEXT: ret i1 [[TMP2 ]]
2249
2230
;
2250
2231
%a = and i32 %x , %y
2251
2232
call void @use32 (i32 %a )
@@ -2259,13 +2240,12 @@ define i1 @samesign_mult_use(i32 %x, i32 %y) {
2259
2240
2260
2241
define i1 @samesign_mult_use2 (i32 %x , i32 %y ) {
2261
2242
; CHECK-LABEL: @samesign_mult_use2(
2262
- ; CHECK-NEXT: [[A:%.*]] = and i32 [[X:%.*]], [[Y:%.*]]
2263
- ; CHECK-NEXT: [[LT:%.*]] = icmp slt i32 [[A]], 0
2264
- ; CHECK-NEXT: [[O:%.*]] = or i32 [[X]], [[Y]]
2243
+ ; CHECK-NEXT: [[O:%.*]] = or i32 [[X:%.*]], [[Y:%.*]]
2265
2244
; CHECK-NEXT: [[GT:%.*]] = icmp sgt i32 [[O]], -1
2266
2245
; CHECK-NEXT: call void @use(i1 [[GT]])
2267
- ; CHECK-NEXT: [[R:%.*]] = or i1 [[LT]], [[GT]]
2268
- ; CHECK-NEXT: ret i1 [[R]]
2246
+ ; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[X]], [[Y]]
2247
+ ; CHECK-NEXT: [[TMP2:%.*]] = icmp sgt i32 [[TMP1]], -1
2248
+ ; CHECK-NEXT: ret i1 [[TMP2]]
2269
2249
;
2270
2250
%a = and i32 %x , %y
2271
2251
%lt = icmp slt i32 %a , 0
@@ -2316,12 +2296,9 @@ define i1 @samesign_wrong_cmp(i32 %x, i32 %y) {
2316
2296
2317
2297
define i1 @samesign_inverted (i32 %x , i32 %y ) {
2318
2298
; CHECK-LABEL: @samesign_inverted(
2319
- ; CHECK-NEXT: [[A:%.*]] = and i32 [[X:%.*]], [[Y:%.*]]
2320
- ; CHECK-NEXT: [[GT:%.*]] = icmp sgt i32 [[A]], -1
2321
- ; CHECK-NEXT: [[O:%.*]] = or i32 [[X]], [[Y]]
2322
- ; CHECK-NEXT: [[LT:%.*]] = icmp slt i32 [[O]], 0
2323
- ; CHECK-NEXT: [[R:%.*]] = and i1 [[GT]], [[LT]]
2324
- ; CHECK-NEXT: ret i1 [[R]]
2299
+ ; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[X:%.*]], [[Y:%.*]]
2300
+ ; CHECK-NEXT: [[TMP2:%.*]] = icmp slt i32 [[TMP1]], 0
2301
+ ; CHECK-NEXT: ret i1 [[TMP2]]
2325
2302
;
2326
2303
%a = and i32 %x , %y
2327
2304
%gt = icmp sgt i32 %a , -1
@@ -2333,12 +2310,9 @@ define i1 @samesign_inverted(i32 %x, i32 %y) {
2333
2310
2334
2311
define i1 @samesign_inverted_different_sign_bittest1 (i32 %x , i32 %y ) {
2335
2312
; CHECK-LABEL: @samesign_inverted_different_sign_bittest1(
2336
- ; CHECK-NEXT: [[A:%.*]] = and i32 [[X:%.*]], [[Y:%.*]]
2337
- ; CHECK-NEXT: [[GT:%.*]] = icmp sgt i32 [[A]], -1
2338
- ; CHECK-NEXT: [[O:%.*]] = or i32 [[X]], [[Y]]
2339
- ; CHECK-NEXT: [[LT:%.*]] = icmp slt i32 [[O]], 0
2340
- ; CHECK-NEXT: [[R:%.*]] = and i1 [[GT]], [[LT]]
2341
- ; CHECK-NEXT: ret i1 [[R]]
2313
+ ; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[X:%.*]], [[Y:%.*]]
2314
+ ; CHECK-NEXT: [[TMP2:%.*]] = icmp slt i32 [[TMP1]], 0
2315
+ ; CHECK-NEXT: ret i1 [[TMP2]]
2342
2316
;
2343
2317
%a = and i32 %x , %y
2344
2318
%gt = icmp sge i32 %a , 0
@@ -2350,12 +2324,9 @@ define i1 @samesign_inverted_different_sign_bittest1(i32 %x, i32 %y) {
2350
2324
2351
2325
define i1 @samesign_inverted_different_sign_bittest2 (i32 %x , i32 %y ) {
2352
2326
; CHECK-LABEL: @samesign_inverted_different_sign_bittest2(
2353
- ; CHECK-NEXT: [[A:%.*]] = and i32 [[X:%.*]], [[Y:%.*]]
2354
- ; CHECK-NEXT: [[GT:%.*]] = icmp sgt i32 [[A]], -1
2355
- ; CHECK-NEXT: [[O:%.*]] = or i32 [[X]], [[Y]]
2356
- ; CHECK-NEXT: [[LT:%.*]] = icmp slt i32 [[O]], 0
2357
- ; CHECK-NEXT: [[R:%.*]] = and i1 [[GT]], [[LT]]
2358
- ; CHECK-NEXT: ret i1 [[R]]
2327
+ ; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[X:%.*]], [[Y:%.*]]
2328
+ ; CHECK-NEXT: [[TMP2:%.*]] = icmp slt i32 [[TMP1]], 0
2329
+ ; CHECK-NEXT: ret i1 [[TMP2]]
2359
2330
;
2360
2331
%a = and i32 %x , %y
2361
2332
%gt = icmp sgt i32 %a , -1
@@ -2367,12 +2338,9 @@ define i1 @samesign_inverted_different_sign_bittest2(i32 %x, i32 %y) {
2367
2338
2368
2339
define i1 @samesign_inverted_commute1 (i32 %x , i32 %y ) {
2369
2340
; CHECK-LABEL: @samesign_inverted_commute1(
2370
- ; CHECK-NEXT: [[A:%.*]] = and i32 [[X:%.*]], [[Y:%.*]]
2371
- ; CHECK-NEXT: [[GT:%.*]] = icmp sgt i32 [[A]], -1
2372
- ; CHECK-NEXT: [[O:%.*]] = or i32 [[X]], [[Y]]
2373
- ; CHECK-NEXT: [[LT:%.*]] = icmp slt i32 [[O]], 0
2374
- ; CHECK-NEXT: [[R:%.*]] = and i1 [[LT]], [[GT]]
2375
- ; CHECK-NEXT: ret i1 [[R]]
2341
+ ; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[X:%.*]], [[Y:%.*]]
2342
+ ; CHECK-NEXT: [[TMP2:%.*]] = icmp slt i32 [[TMP1]], 0
2343
+ ; CHECK-NEXT: ret i1 [[TMP2]]
2376
2344
;
2377
2345
%a = and i32 %x , %y
2378
2346
%gt = icmp sgt i32 %a , -1
@@ -2384,12 +2352,9 @@ define i1 @samesign_inverted_commute1(i32 %x, i32 %y) {
2384
2352
2385
2353
define i1 @samesign_inverted_commute2 (i32 %x , i32 %y ) {
2386
2354
; CHECK-LABEL: @samesign_inverted_commute2(
2387
- ; CHECK-NEXT: [[A:%.*]] = and i32 [[X:%.*]], [[Y:%.*]]
2388
- ; CHECK-NEXT: [[GT:%.*]] = icmp sgt i32 [[A]], -1
2389
- ; CHECK-NEXT: [[O:%.*]] = or i32 [[Y]], [[X]]
2390
- ; CHECK-NEXT: [[LT:%.*]] = icmp slt i32 [[O]], 0
2391
- ; CHECK-NEXT: [[R:%.*]] = and i1 [[GT]], [[LT]]
2392
- ; CHECK-NEXT: ret i1 [[R]]
2355
+ ; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[X:%.*]], [[Y:%.*]]
2356
+ ; CHECK-NEXT: [[TMP2:%.*]] = icmp slt i32 [[TMP1]], 0
2357
+ ; CHECK-NEXT: ret i1 [[TMP2]]
2393
2358
;
2394
2359
%a = and i32 %x , %y
2395
2360
%gt = icmp sgt i32 %a , -1
@@ -2401,12 +2366,9 @@ define i1 @samesign_inverted_commute2(i32 %x, i32 %y) {
2401
2366
2402
2367
define i1 @samesign_inverted_commute3 (i32 %x , i32 %y ) {
2403
2368
; CHECK-LABEL: @samesign_inverted_commute3(
2404
- ; CHECK-NEXT: [[A:%.*]] = and i32 [[X:%.*]], [[Y:%.*]]
2405
- ; CHECK-NEXT: [[GT:%.*]] = icmp sgt i32 [[A]], -1
2406
- ; CHECK-NEXT: [[O:%.*]] = or i32 [[Y]], [[X]]
2407
- ; CHECK-NEXT: [[LT:%.*]] = icmp slt i32 [[O]], 0
2408
- ; CHECK-NEXT: [[R:%.*]] = and i1 [[LT]], [[GT]]
2409
- ; CHECK-NEXT: ret i1 [[R]]
2369
+ ; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[Y:%.*]], [[X:%.*]]
2370
+ ; CHECK-NEXT: [[TMP2:%.*]] = icmp slt i32 [[TMP1]], 0
2371
+ ; CHECK-NEXT: ret i1 [[TMP2]]
2410
2372
;
2411
2373
%a = and i32 %x , %y
2412
2374
%gt = icmp sgt i32 %a , -1
@@ -2453,12 +2415,11 @@ define i1 @samesign_inverted_mult_use(i32 %x, i32 %y) {
2453
2415
; CHECK-LABEL: @samesign_inverted_mult_use(
2454
2416
; CHECK-NEXT: [[A:%.*]] = and i32 [[X:%.*]], [[Y:%.*]]
2455
2417
; CHECK-NEXT: call void @use32(i32 [[A]])
2456
- ; CHECK-NEXT: [[GT:%.*]] = icmp sgt i32 [[A]], -1
2457
2418
; CHECK-NEXT: [[O:%.*]] = or i32 [[X]], [[Y]]
2458
2419
; CHECK-NEXT: call void @use32(i32 [[O]])
2459
- ; CHECK-NEXT: [[LT :%.*]] = icmp slt i32 [[O ]], 0
2460
- ; CHECK-NEXT: [[R :%.*]] = and i1 [[GT ]], [[LT]]
2461
- ; CHECK-NEXT: ret i1 [[R ]]
2420
+ ; CHECK-NEXT: [[TMP1 :%.*]] = xor i32 [[X ]], [[Y]]
2421
+ ; CHECK-NEXT: [[TMP2 :%.*]] = icmp slt i32 [[TMP1 ]], 0
2422
+ ; CHECK-NEXT: ret i1 [[TMP2 ]]
2462
2423
;
2463
2424
%a = and i32 %x , %y
2464
2425
call void @use32 (i32 %a )
0 commit comments