2016-07-13 00:13:04 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
|
|
; RUN: opt < %s -instcombine -S | FileCheck %s
|
|
|
|
|
|
|
|
@G1 = global i32 0
|
|
|
|
@G2 = global i32 0
|
2003-07-24 05:10:55 +08:00
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i1 @test0(i1 %A) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test0(
|
2016-07-13 00:13:04 +08:00
|
|
|
; CHECK-NEXT: ret i1 %A
|
|
|
|
;
|
|
|
|
%B = xor i1 %A, false
|
|
|
|
ret i1 %B
|
2008-03-01 17:15:35 +08:00
|
|
|
}
|
2003-07-24 05:10:55 +08:00
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i32 @test1(i32 %A) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test1(
|
2016-07-13 00:13:04 +08:00
|
|
|
; CHECK-NEXT: ret i32 %A
|
|
|
|
;
|
|
|
|
%B = xor i32 %A, 0
|
|
|
|
ret i32 %B
|
2003-07-24 05:10:55 +08:00
|
|
|
}
|
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i1 @test2(i1 %A) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test2(
|
2016-07-13 00:13:04 +08:00
|
|
|
; CHECK-NEXT: ret i1 false
|
|
|
|
;
|
|
|
|
%B = xor i1 %A, %A
|
|
|
|
ret i1 %B
|
2003-07-24 05:10:55 +08:00
|
|
|
}
|
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i32 @test3(i32 %A) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test3(
|
2016-07-13 00:13:04 +08:00
|
|
|
; CHECK-NEXT: ret i32 0
|
|
|
|
;
|
|
|
|
%B = xor i32 %A, %A
|
|
|
|
ret i32 %B
|
2003-07-24 05:10:55 +08:00
|
|
|
}
|
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i32 @test4(i32 %A) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test4(
|
2016-07-13 00:13:04 +08:00
|
|
|
; CHECK-NEXT: ret i32 -1
|
|
|
|
;
|
|
|
|
%NotA = xor i32 -1, %A
|
|
|
|
%B = xor i32 %A, %NotA
|
|
|
|
ret i32 %B
|
2003-07-24 05:10:55 +08:00
|
|
|
}
|
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i32 @test5(i32 %A) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test5(
|
2016-07-13 00:13:04 +08:00
|
|
|
; CHECK-NEXT: [[TMP1:%.*]] = and i32 %A, -124
|
|
|
|
; CHECK-NEXT: ret i32 [[TMP1]]
|
|
|
|
;
|
|
|
|
%t1 = or i32 %A, 123
|
|
|
|
%r = xor i32 %t1, 123
|
|
|
|
ret i32 %r
|
2003-07-24 05:10:55 +08:00
|
|
|
}
|
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i8 @test6(i8 %A) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test6(
|
2016-07-13 00:13:04 +08:00
|
|
|
; CHECK-NEXT: ret i8 %A
|
|
|
|
;
|
|
|
|
%B = xor i8 %A, 17
|
|
|
|
%C = xor i8 %B, 17
|
|
|
|
ret i8 %C
|
2003-07-24 05:10:55 +08:00
|
|
|
}
|
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i32 @test7(i32 %A, i32 %B) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test7(
|
2016-07-13 00:13:04 +08:00
|
|
|
; CHECK-NEXT: [[A1:%.*]] = and i32 %A, 7
|
|
|
|
; CHECK-NEXT: [[B1:%.*]] = and i32 %B, 128
|
|
|
|
; CHECK-NEXT: [[C11:%.*]] = or i32 [[A1]], [[B1]]
|
|
|
|
; CHECK-NEXT: ret i32 [[C11]]
|
|
|
|
;
|
|
|
|
%A1 = and i32 %A, 7
|
|
|
|
%B1 = and i32 %B, 128
|
|
|
|
%C1 = xor i32 %A1, %B1
|
|
|
|
ret i32 %C1
|
2003-07-24 05:10:55 +08:00
|
|
|
}
|
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i8 @test8(i1 %c) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test8(
|
2016-07-13 00:13:04 +08:00
|
|
|
; CHECK-NEXT: br i1 %c, label %False, label %True
|
|
|
|
; CHECK: True:
|
|
|
|
; CHECK-NEXT: ret i8 1
|
|
|
|
; CHECK: False:
|
|
|
|
; CHECK-NEXT: ret i8 3
|
|
|
|
;
|
|
|
|
%d = xor i1 %c, true
|
|
|
|
br i1 %d, label %True, label %False
|
2003-07-24 05:11:56 +08:00
|
|
|
|
2016-07-13 00:13:04 +08:00
|
|
|
True:
|
|
|
|
ret i8 1
|
2003-07-24 05:10:55 +08:00
|
|
|
|
2016-07-13 00:13:04 +08:00
|
|
|
False:
|
|
|
|
ret i8 3
|
2003-07-24 05:10:55 +08:00
|
|
|
}
|
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i1 @test9(i8 %A) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test9(
|
2016-07-13 00:13:04 +08:00
|
|
|
; CHECK-NEXT: [[C:%.*]] = icmp eq i8 %A, 89
|
|
|
|
; CHECK-NEXT: ret i1 [[C]]
|
|
|
|
;
|
|
|
|
%B = xor i8 %A, 123
|
|
|
|
%C = icmp eq i8 %B, 34
|
|
|
|
ret i1 %C
|
2003-07-24 05:10:55 +08:00
|
|
|
}
|
2003-07-24 05:36:01 +08:00
|
|
|
|
2016-07-23 05:02:33 +08:00
|
|
|
define <2 x i1> @test9vec(<2 x i8> %a) {
|
|
|
|
; CHECK-LABEL: @test9vec(
|
2016-08-04 02:59:03 +08:00
|
|
|
; CHECK-NEXT: [[C:%.*]] = icmp eq <2 x i8> %a, <i8 89, i8 89>
|
2016-07-23 05:02:33 +08:00
|
|
|
; CHECK-NEXT: ret <2 x i1> [[C]]
|
|
|
|
;
|
|
|
|
%b = xor <2 x i8> %a, <i8 123, i8 123>
|
|
|
|
%c = icmp eq <2 x i8> %b, <i8 34, i8 34>
|
|
|
|
ret <2 x i1> %c
|
|
|
|
}
|
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i8 @test10(i8 %A) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test10(
|
2016-07-13 00:13:04 +08:00
|
|
|
; CHECK-NEXT: [[B:%.*]] = and i8 %A, 3
|
|
|
|
; CHECK-NEXT: [[C1:%.*]] = or i8 [[B]], 4
|
|
|
|
; CHECK-NEXT: ret i8 [[C1]]
|
|
|
|
;
|
|
|
|
%B = and i8 %A, 3
|
|
|
|
%C = xor i8 %B, 4
|
|
|
|
ret i8 %C
|
2003-07-24 05:36:01 +08:00
|
|
|
}
|
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i8 @test11(i8 %A) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test11(
|
2016-07-13 00:13:04 +08:00
|
|
|
; CHECK-NEXT: [[B:%.*]] = and i8 %A, -13
|
|
|
|
; CHECK-NEXT: [[TMP1:%.*]] = or i8 [[B]], 8
|
|
|
|
; CHECK-NEXT: ret i8 [[TMP1]]
|
|
|
|
;
|
|
|
|
%B = or i8 %A, 12
|
|
|
|
%C = xor i8 %B, 4
|
|
|
|
ret i8 %C
|
2003-07-24 05:36:01 +08:00
|
|
|
}
|
2003-08-13 13:27:57 +08:00
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i1 @test12(i8 %A) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test12(
|
2016-07-13 00:13:04 +08:00
|
|
|
; CHECK-NEXT: [[C:%.*]] = icmp ne i8 %A, 4
|
|
|
|
; CHECK-NEXT: ret i1 [[C]]
|
|
|
|
;
|
|
|
|
%B = xor i8 %A, 4
|
|
|
|
%c = icmp ne i8 %B, 0
|
|
|
|
ret i1 %c
|
2003-08-13 13:27:57 +08:00
|
|
|
}
|
2003-08-14 04:13:15 +08:00
|
|
|
|
2016-07-23 05:02:33 +08:00
|
|
|
define <2 x i1> @test12vec(<2 x i8> %a) {
|
|
|
|
; CHECK-LABEL: @test12vec(
|
2016-08-04 02:59:03 +08:00
|
|
|
; CHECK-NEXT: [[C:%.*]] = icmp ne <2 x i8> %a, <i8 4, i8 4>
|
2016-07-23 05:02:33 +08:00
|
|
|
; CHECK-NEXT: ret <2 x i1> [[C]]
|
|
|
|
;
|
|
|
|
%b = xor <2 x i8> %a, <i8 4, i8 4>
|
|
|
|
%c = icmp ne <2 x i8> %b, zeroinitializer
|
|
|
|
ret <2 x i1> %c
|
|
|
|
}
|
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i32 @test15(i32 %A) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test15(
|
2016-07-13 00:13:04 +08:00
|
|
|
; CHECK-NEXT: [[C:%.*]] = sub i32 0, %A
|
|
|
|
; CHECK-NEXT: ret i32 [[C]]
|
|
|
|
;
|
|
|
|
%B = add i32 %A, -1
|
|
|
|
%C = xor i32 %B, -1
|
|
|
|
ret i32 %C
|
2003-11-05 07:21:22 +08:00
|
|
|
}
|
2003-11-05 07:36:50 +08:00
|
|
|
|
2017-08-06 14:28:41 +08:00
|
|
|
define <2 x i32> @test15vec(<2 x i32> %A) {
|
|
|
|
; CHECK-LABEL: @test15vec(
|
|
|
|
; CHECK-NEXT: [[C:%.*]] = sub <2 x i32> zeroinitializer, [[A:%.*]]
|
|
|
|
; CHECK-NEXT: ret <2 x i32> [[C]]
|
|
|
|
;
|
|
|
|
%B = add <2 x i32> %A, <i32 -1, i32 -1>
|
|
|
|
%C = xor <2 x i32> %B, <i32 -1, i32 -1>
|
|
|
|
ret <2 x i32> %C
|
|
|
|
}
|
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i32 @test16(i32 %A) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test16(
|
2016-07-13 00:13:04 +08:00
|
|
|
; CHECK-NEXT: [[C:%.*]] = sub i32 -124, %A
|
|
|
|
; CHECK-NEXT: ret i32 [[C]]
|
|
|
|
;
|
|
|
|
%B = add i32 %A, 123
|
|
|
|
%C = xor i32 %B, -1
|
|
|
|
ret i32 %C
|
2003-11-05 07:36:50 +08:00
|
|
|
}
|
2003-11-05 07:49:53 +08:00
|
|
|
|
2017-08-06 14:28:41 +08:00
|
|
|
define <2 x i32> @test16vec(<2 x i32> %A) {
|
|
|
|
; CHECK-LABEL: @test16vec(
|
|
|
|
; CHECK-NEXT: [[C:%.*]] = sub <2 x i32> <i32 -124, i32 -124>, [[A:%.*]]
|
|
|
|
; CHECK-NEXT: ret <2 x i32> [[C]]
|
|
|
|
;
|
|
|
|
%B = add <2 x i32> %A, <i32 123, i32 123>
|
|
|
|
%C = xor <2 x i32> %B, <i32 -1, i32 -1>
|
|
|
|
ret <2 x i32> %C
|
|
|
|
}
|
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i32 @test17(i32 %A) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test17(
|
2016-07-13 00:13:04 +08:00
|
|
|
; CHECK-NEXT: [[C:%.*]] = add i32 %A, -124
|
|
|
|
; CHECK-NEXT: ret i32 [[C]]
|
|
|
|
;
|
|
|
|
%B = sub i32 123, %A
|
|
|
|
%C = xor i32 %B, -1
|
|
|
|
ret i32 %C
|
2003-11-05 07:49:53 +08:00
|
|
|
}
|
2003-11-05 09:05:22 +08:00
|
|
|
|
2017-08-06 14:28:41 +08:00
|
|
|
define <2 x i32> @test17vec(<2 x i32> %A) {
|
|
|
|
; CHECK-LABEL: @test17vec(
|
|
|
|
; CHECK-NEXT: [[C:%.*]] = add <2 x i32> [[A:%.*]], <i32 -124, i32 -124>
|
|
|
|
; CHECK-NEXT: ret <2 x i32> [[C]]
|
|
|
|
;
|
|
|
|
%B = sub <2 x i32> <i32 123, i32 123>, %A
|
|
|
|
%C = xor <2 x i32> %B, <i32 -1, i32 -1>
|
|
|
|
ret <2 x i32> %C
|
|
|
|
}
|
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i32 @test18(i32 %A) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test18(
|
2016-07-13 00:13:04 +08:00
|
|
|
; CHECK-NEXT: [[C:%.*]] = add i32 %A, 124
|
|
|
|
; CHECK-NEXT: ret i32 [[C]]
|
|
|
|
;
|
|
|
|
%B = xor i32 %A, -1
|
|
|
|
%C = sub i32 123, %B
|
|
|
|
ret i32 %C
|
2003-11-05 09:05:22 +08:00
|
|
|
}
|
2004-02-16 09:19:52 +08:00
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i32 @test19(i32 %A, i32 %B) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test19(
|
2016-07-13 00:13:04 +08:00
|
|
|
; CHECK-NEXT: ret i32 %B
|
|
|
|
;
|
|
|
|
%C = xor i32 %A, %B
|
|
|
|
%D = xor i32 %C, %A
|
|
|
|
ret i32 %D
|
2004-02-16 09:19:52 +08:00
|
|
|
}
|
2004-02-16 11:53:44 +08:00
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define void @test20(i32 %A, i32 %B) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test20(
|
2016-07-13 00:13:04 +08:00
|
|
|
; CHECK-NEXT: store i32 %B, i32* @G1, align 4
|
|
|
|
; CHECK-NEXT: store i32 %A, i32* @G2, align 4
|
|
|
|
; CHECK-NEXT: ret void
|
|
|
|
;
|
|
|
|
%t2 = xor i32 %B, %A
|
|
|
|
%t5 = xor i32 %t2, %B
|
|
|
|
%t8 = xor i32 %t5, %t2
|
|
|
|
store i32 %t8, i32* @G1
|
|
|
|
store i32 %t5, i32* @G2
|
|
|
|
ret void
|
2004-02-16 11:53:44 +08:00
|
|
|
}
|
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i32 @test21(i1 %C, i32 %A, i32 %B) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test21(
|
2016-07-13 00:13:04 +08:00
|
|
|
; CHECK-NEXT: [[D:%.*]] = select i1 %C, i32 %B, i32 %A
|
|
|
|
; CHECK-NEXT: ret i32 [[D]]
|
|
|
|
;
|
|
|
|
%C2 = xor i1 %C, true
|
|
|
|
%D = select i1 %C2, i32 %A, i32 %B
|
|
|
|
ret i32 %D
|
2005-04-24 15:28:53 +08:00
|
|
|
}
|
2005-05-06 12:11:32 +08:00
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i32 @test22(i1 %X) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test22(
|
2016-07-23 05:02:33 +08:00
|
|
|
; CHECK-NEXT: [[Z:%.*]] = zext i1 %X to i32
|
|
|
|
; CHECK-NEXT: ret i32 [[Z]]
|
2016-07-13 00:13:04 +08:00
|
|
|
;
|
|
|
|
%Y = xor i1 %X, true
|
|
|
|
%Z = zext i1 %Y to i32
|
|
|
|
%Q = xor i32 %Z, 1
|
|
|
|
ret i32 %Q
|
2005-05-06 12:11:32 +08:00
|
|
|
}
|
|
|
|
|
2016-07-14 02:40:38 +08:00
|
|
|
; Look through a zext between xors.
|
|
|
|
|
|
|
|
define i32 @fold_zext_xor_sandwich(i1 %X) {
|
|
|
|
; CHECK-LABEL: @fold_zext_xor_sandwich(
|
2016-07-23 05:02:33 +08:00
|
|
|
; CHECK-NEXT: [[Z:%.*]] = zext i1 %X to i32
|
|
|
|
; CHECK-NEXT: [[Q:%.*]] = xor i32 [[Z]], 3
|
2016-07-14 02:40:38 +08:00
|
|
|
; CHECK-NEXT: ret i32 [[Q]]
|
|
|
|
;
|
|
|
|
%Y = xor i1 %X, true
|
|
|
|
%Z = zext i1 %Y to i32
|
|
|
|
%Q = xor i32 %Z, 2
|
|
|
|
ret i32 %Q
|
|
|
|
}
|
|
|
|
|
2016-07-14 02:58:55 +08:00
|
|
|
define <2 x i32> @fold_zext_xor_sandwich_vec(<2 x i1> %X) {
|
|
|
|
; CHECK-LABEL: @fold_zext_xor_sandwich_vec(
|
2016-07-23 05:02:33 +08:00
|
|
|
; CHECK-NEXT: [[Z:%.*]] = zext <2 x i1> %X to <2 x i32>
|
|
|
|
; CHECK-NEXT: [[Q:%.*]] = xor <2 x i32> [[Z]], <i32 3, i32 3>
|
2016-07-14 02:58:55 +08:00
|
|
|
; CHECK-NEXT: ret <2 x i32> [[Q]]
|
|
|
|
;
|
|
|
|
%Y = xor <2 x i1> %X, <i1 true, i1 true>
|
|
|
|
%Z = zext <2 x i1> %Y to <2 x i32>
|
|
|
|
%Q = xor <2 x i32> %Z, <i32 2, i32 2>
|
|
|
|
ret <2 x i32> %Q
|
|
|
|
}
|
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i1 @test23(i32 %a, i32 %b) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test23(
|
2016-07-13 00:13:04 +08:00
|
|
|
; CHECK-NEXT: [[T4:%.*]] = icmp eq i32 %b, 0
|
|
|
|
; CHECK-NEXT: ret i1 [[T4]]
|
|
|
|
;
|
|
|
|
%t2 = xor i32 %b, %a
|
|
|
|
%t4 = icmp eq i32 %t2, %a
|
|
|
|
ret i1 %t4
|
2006-02-27 09:43:02 +08:00
|
|
|
}
|
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i1 @test24(i32 %c, i32 %d) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test24(
|
2016-07-13 00:13:04 +08:00
|
|
|
; CHECK-NEXT: [[T4:%.*]] = icmp ne i32 %d, 0
|
|
|
|
; CHECK-NEXT: ret i1 [[T4]]
|
|
|
|
;
|
|
|
|
%t2 = xor i32 %d, %c
|
|
|
|
%t4 = icmp ne i32 %t2, %c
|
|
|
|
ret i1 %t4
|
2006-02-27 09:43:02 +08:00
|
|
|
}
|
2006-04-01 16:02:51 +08:00
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i32 @test25(i32 %g, i32 %h) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test25(
|
2016-07-13 00:13:04 +08:00
|
|
|
; CHECK-NEXT: [[T4:%.*]] = and i32 %h, %g
|
|
|
|
; CHECK-NEXT: ret i32 [[T4]]
|
|
|
|
;
|
|
|
|
%h2 = xor i32 %h, -1
|
|
|
|
%t2 = and i32 %h2, %g
|
|
|
|
%t4 = xor i32 %t2, %g
|
|
|
|
ret i32 %t4
|
2006-04-01 16:02:51 +08:00
|
|
|
}
|
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i32 @test26(i32 %a, i32 %b) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test26(
|
2017-02-04 05:43:34 +08:00
|
|
|
; CHECK-NEXT: [[T4:%.*]] = and i32 %b, %a
|
2016-07-13 00:13:04 +08:00
|
|
|
; CHECK-NEXT: ret i32 [[T4]]
|
|
|
|
;
|
|
|
|
%b2 = xor i32 %b, -1
|
|
|
|
%t2 = xor i32 %a, %b2
|
|
|
|
%t4 = and i32 %t2, %a
|
|
|
|
ret i32 %t4
|
2006-04-01 16:02:51 +08:00
|
|
|
}
|
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i32 @test27(i32 %b, i32 %c, i32 %d) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test27(
|
2016-07-13 00:13:04 +08:00
|
|
|
; CHECK-NEXT: [[T6:%.*]] = icmp eq i32 %b, %c
|
|
|
|
; CHECK-NEXT: [[T7:%.*]] = zext i1 [[T6]] to i32
|
|
|
|
; CHECK-NEXT: ret i32 [[T7]]
|
|
|
|
;
|
|
|
|
%t2 = xor i32 %d, %b
|
|
|
|
%t5 = xor i32 %d, %c
|
|
|
|
%t6 = icmp eq i32 %t2, %t5
|
|
|
|
%t7 = zext i1 %t6 to i32
|
|
|
|
ret i32 %t7
|
2007-01-05 11:03:51 +08:00
|
|
|
}
|
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i32 @test28(i32 %indvar) {
|
2014-11-25 16:44:56 +08:00
|
|
|
; CHECK-LABEL: @test28(
|
2016-07-13 00:13:04 +08:00
|
|
|
; CHECK-NEXT: [[T214:%.*]] = add i32 %indvar, 1
|
|
|
|
; CHECK-NEXT: ret i32 [[T214]]
|
|
|
|
;
|
|
|
|
%t7 = add i32 %indvar, -2147483647
|
|
|
|
%t214 = xor i32 %t7, -2147483648
|
|
|
|
ret i32 %t214
|
2007-04-02 13:35:08 +08:00
|
|
|
}
|
2017-04-04 01:49:15 +08:00
|
|
|
|
2017-08-07 06:17:21 +08:00
|
|
|
define <2 x i32> @test28vec(<2 x i32> %indvar) {
|
|
|
|
; CHECK-LABEL: @test28vec(
|
|
|
|
; CHECK-NEXT: [[T214:%.*]] = add <2 x i32> [[INDVAR:%.*]], <i32 1, i32 1>
|
|
|
|
; CHECK-NEXT: ret <2 x i32> [[T214]]
|
|
|
|
;
|
|
|
|
%t7 = add <2 x i32> %indvar, <i32 -2147483647, i32 -2147483647>
|
|
|
|
%t214 = xor <2 x i32> %t7, <i32 -2147483648, i32 -2147483648>
|
|
|
|
ret <2 x i32> %t214
|
|
|
|
}
|
|
|
|
|
2017-08-06 04:00:44 +08:00
|
|
|
define i32 @test28_sub(i32 %indvar) {
|
|
|
|
; CHECK-LABEL: @test28_sub(
|
2017-08-06 06:44:38 +08:00
|
|
|
; CHECK-NEXT: [[T214:%.*]] = sub i32 1, [[INDVAR:%.*]]
|
|
|
|
; CHECK-NEXT: ret i32 [[T214]]
|
2017-08-06 04:00:44 +08:00
|
|
|
;
|
|
|
|
%t7 = sub i32 -2147483647, %indvar
|
|
|
|
%t214 = xor i32 %t7, -2147483648
|
|
|
|
ret i32 %t214
|
|
|
|
}
|
|
|
|
|
2017-08-07 06:17:21 +08:00
|
|
|
define <2 x i32> @test28_subvec(<2 x i32> %indvar) {
|
|
|
|
; CHECK-LABEL: @test28_subvec(
|
|
|
|
; CHECK-NEXT: [[T214:%.*]] = sub <2 x i32> <i32 1, i32 1>, [[INDVAR:%.*]]
|
|
|
|
; CHECK-NEXT: ret <2 x i32> [[T214]]
|
|
|
|
;
|
|
|
|
%t7 = sub <2 x i32> <i32 -2147483647, i32 -2147483647>, %indvar
|
|
|
|
%t214 = xor <2 x i32> %t7, <i32 -2147483648, i32 -2147483648>
|
|
|
|
ret <2 x i32> %t214
|
|
|
|
}
|
|
|
|
|
2017-04-04 01:49:15 +08:00
|
|
|
define i32 @test29(i1 %C) {
|
|
|
|
; CHECK-LABEL: @test29(
|
|
|
|
; CHECK-NEXT: [[V:%.*]] = select i1 [[C:%.*]], i32 915, i32 113
|
|
|
|
; CHECK-NEXT: ret i32 [[V]]
|
|
|
|
;
|
|
|
|
%A = select i1 %C, i32 1000, i32 10
|
|
|
|
%V = xor i32 %A, 123
|
|
|
|
ret i32 %V
|
|
|
|
}
|
|
|
|
|
|
|
|
define <2 x i32> @test29vec(i1 %C) {
|
|
|
|
; CHECK-LABEL: @test29vec(
|
2017-04-05 04:26:25 +08:00
|
|
|
; CHECK-NEXT: [[V:%.*]] = select i1 [[C:%.*]], <2 x i32> <i32 915, i32 915>, <2 x i32> <i32 113, i32 113>
|
2017-04-04 01:49:15 +08:00
|
|
|
; CHECK-NEXT: ret <2 x i32> [[V]]
|
|
|
|
;
|
|
|
|
%A = select i1 %C, <2 x i32> <i32 1000, i32 1000>, <2 x i32> <i32 10, i32 10>
|
|
|
|
%V = xor <2 x i32> %A, <i32 123, i32 123>
|
|
|
|
ret <2 x i32> %V
|
|
|
|
}
|
2017-04-05 01:48:08 +08:00
|
|
|
|
|
|
|
define <2 x i32> @test29vec2(i1 %C) {
|
|
|
|
; CHECK-LABEL: @test29vec2(
|
2017-04-05 04:26:25 +08:00
|
|
|
; CHECK-NEXT: [[V:%.*]] = select i1 [[C:%.*]], <2 x i32> <i32 915, i32 2185>, <2 x i32> <i32 113, i32 339>
|
2017-04-05 01:48:08 +08:00
|
|
|
; CHECK-NEXT: ret <2 x i32> [[V]]
|
|
|
|
;
|
|
|
|
%A = select i1 %C, <2 x i32> <i32 1000, i32 2500>, <2 x i32> <i32 10, i32 30>
|
|
|
|
%V = xor <2 x i32> %A, <i32 123, i32 333>
|
|
|
|
ret <2 x i32> %V
|
|
|
|
}
|
2017-04-05 03:31:21 +08:00
|
|
|
|
|
|
|
define i32 @test30(i1 %which) {
|
|
|
|
; CHECK-LABEL: @test30(
|
|
|
|
; CHECK-NEXT: entry:
|
|
|
|
; CHECK-NEXT: br i1 [[WHICH:%.*]], label [[FINAL:%.*]], label [[DELAY:%.*]]
|
|
|
|
; CHECK: delay:
|
|
|
|
; CHECK-NEXT: br label [[FINAL]]
|
|
|
|
; CHECK: final:
|
|
|
|
; CHECK-NEXT: [[A:%.*]] = phi i32 [ 915, [[ENTRY:%.*]] ], [ 113, [[DELAY]] ]
|
|
|
|
; CHECK-NEXT: ret i32 [[A]]
|
|
|
|
;
|
|
|
|
entry:
|
|
|
|
br i1 %which, label %final, label %delay
|
|
|
|
|
|
|
|
delay:
|
|
|
|
br label %final
|
|
|
|
|
|
|
|
final:
|
|
|
|
%A = phi i32 [ 1000, %entry ], [ 10, %delay ]
|
|
|
|
%value = xor i32 %A, 123
|
|
|
|
ret i32 %value
|
|
|
|
}
|
|
|
|
|
|
|
|
define <2 x i32> @test30vec(i1 %which) {
|
|
|
|
; CHECK-LABEL: @test30vec(
|
|
|
|
; CHECK-NEXT: entry:
|
|
|
|
; CHECK-NEXT: br i1 [[WHICH:%.*]], label [[FINAL:%.*]], label [[DELAY:%.*]]
|
|
|
|
; CHECK: delay:
|
|
|
|
; CHECK-NEXT: br label [[FINAL]]
|
|
|
|
; CHECK: final:
|
2017-04-05 04:26:25 +08:00
|
|
|
; CHECK-NEXT: [[A:%.*]] = phi <2 x i32> [ <i32 915, i32 915>, [[ENTRY:%.*]] ], [ <i32 113, i32 113>, [[DELAY]] ]
|
|
|
|
; CHECK-NEXT: ret <2 x i32> [[A]]
|
2017-04-05 03:31:21 +08:00
|
|
|
;
|
|
|
|
entry:
|
|
|
|
br i1 %which, label %final, label %delay
|
|
|
|
|
|
|
|
delay:
|
|
|
|
br label %final
|
|
|
|
|
|
|
|
final:
|
|
|
|
%A = phi <2 x i32> [ <i32 1000, i32 1000>, %entry ], [ <i32 10, i32 10>, %delay ]
|
|
|
|
%value = xor <2 x i32> %A, <i32 123, i32 123>
|
|
|
|
ret <2 x i32> %value
|
|
|
|
}
|
|
|
|
|
|
|
|
define <2 x i32> @test30vec2(i1 %which) {
|
|
|
|
; CHECK-LABEL: @test30vec2(
|
|
|
|
; CHECK-NEXT: entry:
|
|
|
|
; CHECK-NEXT: br i1 [[WHICH:%.*]], label [[FINAL:%.*]], label [[DELAY:%.*]]
|
|
|
|
; CHECK: delay:
|
|
|
|
; CHECK-NEXT: br label [[FINAL]]
|
|
|
|
; CHECK: final:
|
2017-04-05 04:26:25 +08:00
|
|
|
; CHECK-NEXT: [[A:%.*]] = phi <2 x i32> [ <i32 915, i32 2185>, [[ENTRY:%.*]] ], [ <i32 113, i32 339>, [[DELAY]] ]
|
|
|
|
; CHECK-NEXT: ret <2 x i32> [[A]]
|
2017-04-05 03:31:21 +08:00
|
|
|
;
|
|
|
|
entry:
|
|
|
|
br i1 %which, label %final, label %delay
|
|
|
|
|
|
|
|
delay:
|
|
|
|
br label %final
|
|
|
|
|
|
|
|
final:
|
|
|
|
%A = phi <2 x i32> [ <i32 1000, i32 2500>, %entry ], [ <i32 10, i32 30>, %delay ]
|
|
|
|
%value = xor <2 x i32> %A, <i32 123, i32 333>
|
|
|
|
ret <2 x i32> %value
|
|
|
|
}
|
2017-04-12 02:50:48 +08:00
|
|
|
|
|
|
|
define i32 @test31(i32 %A, i32 %B) {
|
|
|
|
; CHECK-LABEL: @test31(
|
|
|
|
; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[B:%.*]], -1
|
|
|
|
; CHECK-NEXT: [[XOR:%.*]] = and i32 [[TMP1]], [[A:%.*]]
|
|
|
|
; CHECK-NEXT: ret i32 [[XOR]]
|
|
|
|
;
|
|
|
|
%and = or i32 %A, %B
|
|
|
|
%xor = xor i32 %B, %and
|
|
|
|
ret i32 %xor
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @test32(i32 %A, i32 %B) {
|
|
|
|
; CHECK-LABEL: @test32(
|
|
|
|
; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[B:%.*]], -1
|
|
|
|
; CHECK-NEXT: [[XOR:%.*]] = and i32 [[TMP1]], [[A:%.*]]
|
|
|
|
; CHECK-NEXT: ret i32 [[XOR]]
|
|
|
|
;
|
|
|
|
%and = or i32 %B, %A
|
|
|
|
%xor = xor i32 %B, %and
|
|
|
|
ret i32 %xor
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @test33(i32 %A, i32 %B) {
|
|
|
|
; CHECK-LABEL: @test33(
|
|
|
|
; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[B:%.*]], -1
|
|
|
|
; CHECK-NEXT: [[XOR:%.*]] = and i32 [[TMP1]], [[A:%.*]]
|
|
|
|
; CHECK-NEXT: ret i32 [[XOR]]
|
|
|
|
;
|
|
|
|
%and = or i32 %A, %B
|
|
|
|
%xor = xor i32 %and, %B
|
|
|
|
ret i32 %xor
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @test34(i32 %A, i32 %B) {
|
|
|
|
; CHECK-LABEL: @test34(
|
|
|
|
; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[B:%.*]], -1
|
|
|
|
; CHECK-NEXT: [[XOR:%.*]] = and i32 [[TMP1]], [[A:%.*]]
|
|
|
|
; CHECK-NEXT: ret i32 [[XOR]]
|
|
|
|
;
|
|
|
|
%and = or i32 %B, %A
|
|
|
|
%xor = xor i32 %and, %B
|
|
|
|
ret i32 %xor
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @test35(i32 %A, i32 %B) {
|
|
|
|
; CHECK-LABEL: @test35(
|
|
|
|
; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[A:%.*]], -1
|
|
|
|
; CHECK-NEXT: [[XOR:%.*]] = and i32 [[TMP1]], [[B:%.*]]
|
|
|
|
; CHECK-NEXT: ret i32 [[XOR]]
|
|
|
|
;
|
|
|
|
%and = and i32 %A, %B
|
|
|
|
%xor = xor i32 %B, %and
|
|
|
|
ret i32 %xor
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @test36(i32 %A, i32 %B) {
|
|
|
|
; CHECK-LABEL: @test36(
|
|
|
|
; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[A:%.*]], -1
|
|
|
|
; CHECK-NEXT: [[XOR:%.*]] = and i32 [[TMP1]], [[B:%.*]]
|
|
|
|
; CHECK-NEXT: ret i32 [[XOR]]
|
|
|
|
;
|
|
|
|
%and = and i32 %B, %A
|
|
|
|
%xor = xor i32 %B, %and
|
|
|
|
ret i32 %xor
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @test37(i32 %A, i32 %B) {
|
|
|
|
; CHECK-LABEL: @test37(
|
|
|
|
; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[A:%.*]], -1
|
|
|
|
; CHECK-NEXT: [[XOR:%.*]] = and i32 [[TMP1]], [[B:%.*]]
|
|
|
|
; CHECK-NEXT: ret i32 [[XOR]]
|
|
|
|
;
|
|
|
|
%and = and i32 %A, %B
|
|
|
|
%xor = xor i32 %and, %B
|
|
|
|
ret i32 %xor
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @test38(i32 %A, i32 %B) {
|
|
|
|
; CHECK-LABEL: @test38(
|
|
|
|
; CHECK-NEXT: [[TMP1:%.*]] = xor i32 [[A:%.*]], -1
|
|
|
|
; CHECK-NEXT: [[XOR:%.*]] = and i32 [[TMP1]], [[B:%.*]]
|
|
|
|
; CHECK-NEXT: ret i32 [[XOR]]
|
|
|
|
;
|
|
|
|
%and = and i32 %B, %A
|
|
|
|
%xor = xor i32 %and, %B
|
|
|
|
ret i32 %xor
|
|
|
|
}
|