1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instsimplify -S | FileCheck %s
8 ; CHECK-NEXT: call void (...) @use(i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i32 poison, i8 poison, float poison, float poison, float poison, float poison)
11 %i1 = trunc i32 poison to i8
12 %i2 = zext i4 poison to i8
13 %i3 = sext i4 poison to i8
14 %i4 = fptoui float poison to i8
15 %i5 = fptosi float poison to i8
16 %i6 = bitcast float poison to i32
17 %i7 = ptrtoint ptr poison to i8
18 %f1 = fptrunc double poison to float
19 %f2 = fpext half poison to float
20 %f3 = uitofp i8 poison to float
21 %f4 = sitofp i8 poison to float
22 call void (...) @use(i8 %i1, i8 %i2, i8 %i3, i8 %i4, i8 %i5, i32 %i6, i8 %i7, float %f1, float %f2, float %f3, float %f4)
26 define void @casts2() {
27 ; CHECK-LABEL: @casts2(
28 ; CHECK-NEXT: call void (...) @use(ptr poison, ptr poison)
29 ; CHECK-NEXT: ret void
31 %p1 = inttoptr i8 poison to ptr
32 %p2 = addrspacecast ptr addrspace(1) poison to ptr
33 call void (...) @use(ptr %p1, ptr %p2)
37 define void @unaryops() {
38 ; CHECK-LABEL: @unaryops(
39 ; CHECK-NEXT: call void (...) @use(float poison)
40 ; CHECK-NEXT: ret void
42 %f1 = fneg float poison
43 call void (...) @use(float %f1)
47 define void @binaryops_arith() {
48 ; CHECK-LABEL: @binaryops_arith(
49 ; CHECK-NEXT: call void (...) @use(i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, float poison, float poison, float poison, float poison, float poison, float poison, float poison)
50 ; CHECK-NEXT: ret void
52 %i1 = add i8 poison, 1
53 %i2 = sub i8 poison, 1
54 %i3 = mul i8 poison, 2
55 %i4 = udiv i8 poison, 2
56 %i5 = udiv i8 2, poison
57 %i6 = sdiv i8 poison, 2
58 %i7 = sdiv i8 2, poison
59 %i8 = urem i8 poison, 2
60 %i9 = urem i8 2, poison
61 %i10 = srem i8 poison, 2
62 %i11 = srem i8 2, poison
63 %f1 = fadd float poison, 1.0
64 %f2 = fsub float poison, 1.0
65 %f3 = fmul float poison, 2.0
66 %f4 = fdiv float poison, 2.0
67 %f5 = fdiv float 2.0, poison
68 %f6 = frem float poison, 2.0
69 %f7 = frem float 2.0, poison
70 call void (...) @use(i8 %i1, i8 %i2, i8 %i3, i8 %i4, i8 %i5, i8 %i6, i8 %i7, i8 %i8, i8 %i9, i8 %i10, i8 %i11, float %f1, float %f2, float %f3, float %f4, float %f5, float %f6, float %f7)
74 define void @binaryops_bitwise() {
75 ; CHECK-LABEL: @binaryops_bitwise(
76 ; CHECK-NEXT: call void (...) @use(i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison)
77 ; CHECK-NEXT: ret void
79 %i1 = shl i8 poison, 1
80 %i2 = shl i8 1, poison
81 %i3 = lshr i8 poison, 1
82 %i4 = lshr i8 1, poison
83 %i5 = ashr i8 poison, 1
84 %i6 = ashr i8 1, poison
85 %i7 = and i8 poison, 1
87 %i9 = xor i8 poison, 1
88 call void (...) @use(i8 %i1, i8 %i2, i8 %i3, i8 %i4, i8 %i5, i8 %i6, i8 %i7, i8 %i8, i8 %i9)
92 define void @vec_aggr_ops() {
93 ; CHECK-LABEL: @vec_aggr_ops(
94 ; CHECK-NEXT: call void (...) @use(i8 poison, i8 poison, <2 x i8> poison, i8 poison)
95 ; CHECK-NEXT: ret void
97 %i1 = extractelement <2 x i8> poison, i64 0
98 %i2 = extractelement <2 x i8> zeroinitializer, i64 poison
99 %i3 = insertelement <2 x i8> zeroinitializer, i8 0, i64 poison
100 %i4 = extractvalue {i8, i8} poison, 0
101 call void (...) @use(i8 %i1, i8 %i2, <2 x i8> %i3, i8 %i4)
105 define void @other_ops(i8 %x) {
106 ; CHECK-LABEL: @other_ops(
107 ; CHECK-NEXT: call void (...) @use(i1 poison, i1 poison, i8 poison, i8 poison, ptr poison, ptr poison)
108 ; CHECK-NEXT: ret void
110 %i1 = icmp eq i8 poison, 1
111 %i2 = fcmp oeq float poison, 1.0
112 %i3 = select i1 poison, i8 1, i8 2
113 %i4 = select i1 true, i8 poison, i8 %x
114 call void (...) @use(i1 %i1, i1 %i2, i8 %i3, i8 %i4, ptr getelementptr (i8, ptr poison, i64 1), ptr getelementptr inbounds (i8, ptr undef, i64 1))
118 define void @logicalops_i1(i1 %x) {
119 ; CHECK-LABEL: @logicalops_i1(
120 ; CHECK-NEXT: call void (...) @use(i1 poison, i1 poison)
121 ; CHECK-NEXT: ret void
123 %i1 = or i1 %x, poison
124 %i2 = and i1 %x, poison
125 call void (...) @use(i1 %i1, i1 %i2)