1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -instcombine -S | FileCheck %s
3 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
7 ; CHECK-NEXT: ret i1 false
9 %b = and i1 %x, icmp eq (i8* inttoptr (i32 1 to i8*), i8* inttoptr (i32 2 to i8*))
13 define i1 @f_logical(i1 %x) {
14 ; CHECK-LABEL: @f_logical(
15 ; CHECK-NEXT: ret i1 false
17 %b = select i1 %x, i1 icmp eq (i8* inttoptr (i32 1 to i8*), i8* inttoptr (i32 2 to i8*)), i1 false
21 define i32 @g(i32 %x) {
23 ; CHECK-NEXT: ret i32 [[X:%.*]]
25 %b = add i32 %x, zext (i1 icmp eq (i8* inttoptr (i32 1000000 to i8*), i8* inttoptr (i32 2000000 to i8*)) to i32)
29 define i32 @h(i1 %A, i32 %B) {
31 ; CHECK-NEXT: EntryBlock:
32 ; CHECK-NEXT: [[B_OP:%.*]] = add i32 [[B:%.*]], 2
33 ; CHECK-NEXT: [[OP:%.*]] = select i1 [[A:%.*]], i32 3, i32 [[B_OP]]
34 ; CHECK-NEXT: ret i32 [[OP]]
37 %cf = select i1 %A, i32 1, i32 %B
42 define <4 x float> @h1(i1 %A, <4 x i32> %B) {
44 ; CHECK-NEXT: EntryBlock:
45 ; CHECK-NEXT: [[TMP0:%.*]] = bitcast <4 x i32> [[B:%.*]] to <4 x float>
46 ; CHECK-NEXT: [[BC:%.*]] = select i1 [[A:%.*]], <4 x float> <float 0x36A0000000000000, float 0x36A0000000000000, float 0x36A0000000000000, float 0x36A0000000000000>, <4 x float> [[TMP0]]
47 ; CHECK-NEXT: ret <4 x float> [[BC]]
50 %cf = select i1 %A, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %B
51 %bc = bitcast <4 x i32> %cf to <4 x float>
55 define <vscale x 4 x float> @h2(i1 %A, <vscale x 4 x i32> %B) {
57 ; CHECK-NEXT: EntryBlock:
58 ; CHECK-NEXT: [[TMP0:%.*]] = bitcast <vscale x 4 x i32> [[B:%.*]] to <vscale x 4 x float>
59 ; CHECK-NEXT: [[BC:%.*]] = select i1 [[A:%.*]], <vscale x 4 x float> zeroinitializer, <vscale x 4 x float> [[TMP0]]
60 ; CHECK-NEXT: ret <vscale x 4 x float> [[BC]]
63 %cf = select i1 %A, <vscale x 4 x i32> zeroinitializer, <vscale x 4 x i32> %B
64 %bc = bitcast <vscale x 4 x i32> %cf to <vscale x 4 x float>
65 ret <vscale x 4 x float> %bc
68 define <vscale x 2 x i64> @h3(i1 %A, <vscale x 4 x i32> %B) {
70 ; CHECK-NEXT: EntryBlock:
71 ; CHECK-NEXT: [[CF:%.*]] = select i1 [[A:%.*]], <vscale x 4 x i32> zeroinitializer, <vscale x 4 x i32> [[B:%.*]]
72 ; CHECK-NEXT: [[BC:%.*]] = bitcast <vscale x 4 x i32> [[CF]] to <vscale x 2 x i64>
73 ; CHECK-NEXT: ret <vscale x 2 x i64> [[BC]]
76 %cf = select i1 %A, <vscale x 4 x i32> zeroinitializer, <vscale x 4 x i32> %B
77 %bc = bitcast <vscale x 4 x i32> %cf to <vscale x 2 x i64>
78 ret <vscale x 2 x i64> %bc