brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.9 KiB · 1565fb7 Raw
205 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes=instcombine -S | FileCheck %s3 4; This is related to https://bugs.llvm.org/show_bug.cgi?id=366825 6; In *all* of these, uitofp and bitcast should be instcombine'd out.7 8define i1 @i32_cast_cmp_eq_int_0_uitofp_float(i32 %i) {9; CHECK-LABEL: @i32_cast_cmp_eq_int_0_uitofp_float(10; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i32 [[I:%.*]], 011; CHECK-NEXT:    ret i1 [[CMP]]12;13  %f = uitofp i32 %i to float14  %b = bitcast float %f to i3215  %cmp = icmp eq i32 %b, 016  ret i1 %cmp17}18 19define <2 x i1> @i32_cast_cmp_eq_int_0_uitofp_float_vec(<2 x i32> %i) {20; CHECK-LABEL: @i32_cast_cmp_eq_int_0_uitofp_float_vec(21; CHECK-NEXT:    [[CMP:%.*]] = icmp eq <2 x i32> [[I:%.*]], zeroinitializer22; CHECK-NEXT:    ret <2 x i1> [[CMP]]23;24  %f = uitofp <2 x i32> %i to  <2 x float>25  %b = bitcast <2 x float> %f to <2 x i32>26  %cmp = icmp eq <2 x i32> %b, <i32 0, i32 0>27  ret <2 x i1> %cmp28}29 30define <3 x i1> @i32_cast_cmp_eq_int_0_uitofp_float_vec_poison(<3 x i32> %i) {31; CHECK-LABEL: @i32_cast_cmp_eq_int_0_uitofp_float_vec_poison(32; CHECK-NEXT:    [[CMP:%.*]] = icmp eq <3 x i32> [[I:%.*]], zeroinitializer33; CHECK-NEXT:    ret <3 x i1> [[CMP]]34;35  %f = uitofp <3 x i32> %i to <3 x float>36  %b = bitcast <3 x float> %f to <3 x i32>37  %cmp = icmp eq <3 x i32> %b, <i32 0, i32 poison, i32 0>38  ret <3 x i1> %cmp39}40 41define i1 @i32_cast_cmp_ne_int_0_uitofp_float(i32 %i) {42; CHECK-LABEL: @i32_cast_cmp_ne_int_0_uitofp_float(43; CHECK-NEXT:    [[CMP:%.*]] = icmp ne i32 [[I:%.*]], 044; CHECK-NEXT:    ret i1 [[CMP]]45;46  %f = uitofp i32 %i to float47  %b = bitcast float %f to i3248  %cmp = icmp ne i32 %b, 049  ret i1 %cmp50}51 52define <2 x i1> @i32_cast_cmp_ne_int_0_uitofp_float_vec(<2 x i32> %i) {53; CHECK-LABEL: @i32_cast_cmp_ne_int_0_uitofp_float_vec(54; CHECK-NEXT:    [[CMP:%.*]] = icmp ne <2 x i32> [[I:%.*]], zeroinitializer55; CHECK-NEXT:    ret <2 x i1> [[CMP]]56;57  %f = uitofp <2 x i32> %i to  <2 x float>58  %b = bitcast <2 x float> %f to <2 x i32>59  %cmp = icmp ne <2 x i32> %b, <i32 0, i32 0>60  ret <2 x i1> %cmp61}62 63define <3 x i1> @i32_cast_cmp_ne_int_0_uitofp_float_vec_poison(<3 x i32> %i) {64; CHECK-LABEL: @i32_cast_cmp_ne_int_0_uitofp_float_vec_poison(65; CHECK-NEXT:    [[CMP:%.*]] = icmp ne <3 x i32> [[I:%.*]], zeroinitializer66; CHECK-NEXT:    ret <3 x i1> [[CMP]]67;68  %f = uitofp <3 x i32> %i to <3 x float>69  %b = bitcast <3 x float> %f to <3 x i32>70  %cmp = icmp ne <3 x i32> %b, <i32 0, i32 poison, i32 0>71  ret <3 x i1> %cmp72}73 74define i1 @i32_cast_cmp_eq_int_0_uitofp_double(i32 %i) {75; CHECK-LABEL: @i32_cast_cmp_eq_int_0_uitofp_double(76; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i32 [[I:%.*]], 077; CHECK-NEXT:    ret i1 [[CMP]]78;79  %f = uitofp i32 %i to double80  %b = bitcast double %f to i6481  %cmp = icmp eq i64 %b, 082  ret i1 %cmp83}84 85define <2 x i1> @i32_cast_cmp_eq_int_0_uitofp_double_vec(<2 x i32> %i) {86; CHECK-LABEL: @i32_cast_cmp_eq_int_0_uitofp_double_vec(87; CHECK-NEXT:    [[CMP:%.*]] = icmp eq <2 x i32> [[I:%.*]], zeroinitializer88; CHECK-NEXT:    ret <2 x i1> [[CMP]]89;90  %f = uitofp <2 x i32> %i to  <2 x double>91  %b = bitcast <2 x double> %f to <2 x i64>92  %cmp = icmp eq <2 x i64> %b, <i64 0, i64 0>93  ret <2 x i1> %cmp94}95 96define <3 x i1> @i32_cast_cmp_eq_int_0_uitofp_double_vec_poison(<3 x i32> %i) {97; CHECK-LABEL: @i32_cast_cmp_eq_int_0_uitofp_double_vec_poison(98; CHECK-NEXT:    [[CMP:%.*]] = icmp eq <3 x i32> [[I:%.*]], zeroinitializer99; CHECK-NEXT:    ret <3 x i1> [[CMP]]100;101  %f = uitofp <3 x i32> %i to <3 x double>102  %b = bitcast <3 x double> %f to <3 x i64>103  %cmp = icmp eq <3 x i64> %b, <i64 0, i64 poison, i64 0>104  ret <3 x i1> %cmp105}106 107define i1 @i32_cast_cmp_ne_int_0_uitofp_double(i32 %i) {108; CHECK-LABEL: @i32_cast_cmp_ne_int_0_uitofp_double(109; CHECK-NEXT:    [[CMP:%.*]] = icmp ne i32 [[I:%.*]], 0110; CHECK-NEXT:    ret i1 [[CMP]]111;112  %f = uitofp i32 %i to double113  %b = bitcast double %f to i64114  %cmp = icmp ne i64 %b, 0115  ret i1 %cmp116}117 118define <2 x i1> @i32_cast_cmp_ne_int_0_uitofp_double_vec(<2 x i32> %i) {119; CHECK-LABEL: @i32_cast_cmp_ne_int_0_uitofp_double_vec(120; CHECK-NEXT:    [[CMP:%.*]] = icmp ne <2 x i32> [[I:%.*]], zeroinitializer121; CHECK-NEXT:    ret <2 x i1> [[CMP]]122;123  %f = uitofp <2 x i32> %i to  <2 x double>124  %b = bitcast <2 x double> %f to <2 x i64>125  %cmp = icmp ne <2 x i64> %b, <i64 0, i64 0>126  ret <2 x i1> %cmp127}128 129define <3 x i1> @i32_cast_cmp_ne_int_0_uitofp_double_vec_poison(<3 x i32> %i) {130; CHECK-LABEL: @i32_cast_cmp_ne_int_0_uitofp_double_vec_poison(131; CHECK-NEXT:    [[CMP:%.*]] = icmp ne <3 x i32> [[I:%.*]], zeroinitializer132; CHECK-NEXT:    ret <3 x i1> [[CMP]]133;134  %f = uitofp <3 x i32> %i to <3 x double>135  %b = bitcast <3 x double> %f to <3 x i64>136  %cmp = icmp ne <3 x i64> %b, <i64 0, i64 poison, i64 0>137  ret <3 x i1> %cmp138}139 140define i1 @i32_cast_cmp_eq_int_0_uitofp_half(i32 %i) {141; CHECK-LABEL: @i32_cast_cmp_eq_int_0_uitofp_half(142; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i32 [[I:%.*]], 0143; CHECK-NEXT:    ret i1 [[CMP]]144;145  %f = uitofp i32 %i to half146  %b = bitcast half %f to i16147  %cmp = icmp eq i16 %b, 0148  ret i1 %cmp149}150 151define <2 x i1> @i32_cast_cmp_eq_int_0_uitofp_half_vec(<2 x i32> %i) {152; CHECK-LABEL: @i32_cast_cmp_eq_int_0_uitofp_half_vec(153; CHECK-NEXT:    [[CMP:%.*]] = icmp eq <2 x i32> [[I:%.*]], zeroinitializer154; CHECK-NEXT:    ret <2 x i1> [[CMP]]155;156  %f = uitofp <2 x i32> %i to  <2 x half>157  %b = bitcast <2 x half> %f to <2 x i16>158  %cmp = icmp eq <2 x i16> %b, <i16 0, i16 0>159  ret <2 x i1> %cmp160}161 162define <3 x i1> @i32_cast_cmp_eq_int_0_uitofp_half_vec_poison(<3 x i32> %i) {163; CHECK-LABEL: @i32_cast_cmp_eq_int_0_uitofp_half_vec_poison(164; CHECK-NEXT:    [[CMP:%.*]] = icmp eq <3 x i32> [[I:%.*]], zeroinitializer165; CHECK-NEXT:    ret <3 x i1> [[CMP]]166;167  %f = uitofp <3 x i32> %i to <3 x half>168  %b = bitcast <3 x half> %f to <3 x i16>169  %cmp = icmp eq <3 x i16> %b, <i16 0, i16 poison, i16 0>170  ret <3 x i1> %cmp171}172 173define i1 @i32_cast_cmp_ne_int_0_uitofp_half(i32 %i) {174; CHECK-LABEL: @i32_cast_cmp_ne_int_0_uitofp_half(175; CHECK-NEXT:    [[CMP:%.*]] = icmp ne i32 [[I:%.*]], 0176; CHECK-NEXT:    ret i1 [[CMP]]177;178  %f = uitofp i32 %i to half179  %b = bitcast half %f to i16180  %cmp = icmp ne i16 %b, 0181  ret i1 %cmp182}183 184define <2 x i1> @i32_cast_cmp_ne_int_0_uitofp_half_vec(<2 x i32> %i) {185; CHECK-LABEL: @i32_cast_cmp_ne_int_0_uitofp_half_vec(186; CHECK-NEXT:    [[CMP:%.*]] = icmp ne <2 x i32> [[I:%.*]], zeroinitializer187; CHECK-NEXT:    ret <2 x i1> [[CMP]]188;189  %f = uitofp <2 x i32> %i to  <2 x half>190  %b = bitcast <2 x half> %f to <2 x i16>191  %cmp = icmp ne <2 x i16> %b, <i16 0, i16 0>192  ret <2 x i1> %cmp193}194 195define <3 x i1> @i32_cast_cmp_ne_int_0_uitofp_half_vec_poison(<3 x i32> %i) {196; CHECK-LABEL: @i32_cast_cmp_ne_int_0_uitofp_half_vec_poison(197; CHECK-NEXT:    [[CMP:%.*]] = icmp ne <3 x i32> [[I:%.*]], zeroinitializer198; CHECK-NEXT:    ret <3 x i1> [[CMP]]199;200  %f = uitofp <3 x i32> %i to <3 x half>201  %b = bitcast <3 x half> %f to <3 x i16>202  %cmp = icmp ne <3 x i16> %b, <i16 0, i16 poison, i16 0>203  ret <3 x i1> %cmp204}205