brintos

brintos / llvm-project-archived public Read only

0
0
Text · 8.3 KiB · 125c2dc Raw
187 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 42; RUN: opt -S -passes=slp-vectorizer -slp-threshold=-10000 < %s | FileCheck %s3 4define <2 x float> @test_fdiv(float %a, i1 %cmp) {5; CHECK-LABEL: define <2 x float> @test_fdiv(6; CHECK-SAME: float [[A:%.*]], i1 [[CMP:%.*]]) {7; CHECK-NEXT:    [[TMP1:%.*]] = fdiv float [[A]], 3.000000e+008; CHECK-NEXT:    [[TMP2:%.*]] = insertelement <2 x float> poison, float [[TMP1]], i64 19; CHECK-NEXT:    [[TMP3:%.*]] = select i1 [[CMP]], <2 x float> <float 7.700000e+01, float 9.900000e+01>, <2 x float> [[TMP2]]10; CHECK-NEXT:    ret <2 x float> [[TMP3]]11;12  %1 = fdiv float %a, 3.000000e+0013  %2 = insertelement <2 x float> poison, float %1, i64 114  %3 = select i1 %cmp, <2 x float> <float 7.700000e+01, float 9.900000e+01>, <2 x float> %215  ret <2 x float> %316}17 18define <2 x float> @test_frem(float %a, i1 %cmp) {19; CHECK-LABEL: define <2 x float> @test_frem(20; CHECK-SAME: float [[A:%.*]], i1 [[CMP:%.*]]) {21; CHECK-NEXT:    [[TMP1:%.*]] = frem float [[A]], 3.000000e+0022; CHECK-NEXT:    [[TMP2:%.*]] = insertelement <2 x float> poison, float [[TMP1]], i64 123; CHECK-NEXT:    [[TMP3:%.*]] = select i1 [[CMP]], <2 x float> <float 7.700000e+01, float 9.900000e+01>, <2 x float> [[TMP2]]24; CHECK-NEXT:    ret <2 x float> [[TMP3]]25;26  %1 = frem float %a, 3.000000e+0027  %2 = insertelement <2 x float> poison, float %1, i64 128  %3 = select i1 %cmp, <2 x float> <float 7.700000e+01, float 9.900000e+01>, <2 x float> %229  ret <2 x float> %330}31 32define <2 x float> @replace_through_casts(i16 %inp) {33; CHECK-LABEL: define <2 x float> @replace_through_casts(34; CHECK-SAME: i16 [[INP:%.*]]) {35; CHECK-NEXT:    [[ADD:%.*]] = add nsw i16 [[INP]], -1036; CHECK-NEXT:    [[TMP1:%.*]] = uitofp i16 [[INP]] to float37; CHECK-NEXT:    [[TMP2:%.*]] = sitofp i16 [[ADD]] to float38; CHECK-NEXT:    [[TMP3:%.*]] = insertelement <2 x float> poison, float [[TMP1]], i64 039; CHECK-NEXT:    [[R:%.*]] = insertelement <2 x float> [[TMP3]], float [[TMP2]], i64 140; CHECK-NEXT:    ret <2 x float> [[R]]41;42  %add = add nsw i16 %inp, -1043  %1 = uitofp i16 %inp to float44  %2 = sitofp i16 %add to float45  %3 = insertelement <2 x float> poison, float %1, i64 046  %r = insertelement <2 x float> %3, float %2, i64 147  ret <2 x float> %r48}49 50define <2 x float> @replace_through_casts_and_binop(i16 %inp) {51; CHECK-LABEL: define <2 x float> @replace_through_casts_and_binop(52; CHECK-SAME: i16 [[INP:%.*]]) {53; CHECK-NEXT:    [[ADD:%.*]] = add nsw i16 [[INP]], -1054; CHECK-NEXT:    [[MUL:%.*]] = mul nsw i16 [[INP]], 555; CHECK-NEXT:    [[TMP1:%.*]] = uitofp i16 [[MUL]] to float56; CHECK-NEXT:    [[TMP2:%.*]] = fadd float [[TMP1]], 2.000000e+0057; CHECK-NEXT:    [[TMP3:%.*]] = sitofp i16 [[ADD]] to float58; CHECK-NEXT:    [[TMP4:%.*]] = insertelement <2 x float> poison, float [[TMP2]], i64 059; CHECK-NEXT:    [[R:%.*]] = insertelement <2 x float> [[TMP4]], float [[TMP3]], i64 160; CHECK-NEXT:    ret <2 x float> [[R]]61;62  %add = add nsw i16 %inp, -1063  %mul = mul nsw i16 %inp, 564  %1 = uitofp i16 %mul to float65  %2 = fadd float %1, 2.000000e+0066  %3 = sitofp i16 %add to float67  %4 = insertelement <2 x float> poison, float %2, i64 068  %r = insertelement <2 x float> %4, float %3, i64 169  ret <2 x float> %r70}71 72define <2 x float> @replace_through_casts_and_binop_and_unop(i16 %inp) {73; CHECK-LABEL: define <2 x float> @replace_through_casts_and_binop_and_unop(74; CHECK-SAME: i16 [[INP:%.*]]) {75; CHECK-NEXT:    [[ADD:%.*]] = add nsw i16 [[INP]], -1076; CHECK-NEXT:    [[TMP1:%.*]] = sitofp i16 [[ADD]] to float77; CHECK-NEXT:    [[TMP2:%.*]] = fneg float [[TMP1]]78; CHECK-NEXT:    [[TMP3:%.*]] = uitofp i16 [[ADD]] to float79; CHECK-NEXT:    [[TMP4:%.*]] = fadd float [[TMP3]], 2.000000e+0080; CHECK-NEXT:    [[TMP5:%.*]] = insertelement <2 x float> poison, float [[TMP4]], i64 081; CHECK-NEXT:    [[R:%.*]] = insertelement <2 x float> [[TMP5]], float [[TMP2]], i64 182; CHECK-NEXT:    ret <2 x float> [[R]]83;84  %add = add nsw i16 %inp, -1085  %1 = sitofp i16 %add to float86  %2 = fneg float %187  %3 = uitofp i16 %add to float88  %4 = fadd float %3, 2.000000e+0089  %5 = insertelement <2 x float> poison, float %4, i64 090  %r = insertelement <2 x float> %5, float %2, i64 191  ret <2 x float> %r92}93 94define <2 x float> @replace_through_casts_through_splat(i16 %inp) {95; CHECK-LABEL: define <2 x float> @replace_through_casts_through_splat(96; CHECK-SAME: i16 [[INP:%.*]]) {97; CHECK-NEXT:    [[ADD:%.*]] = add nsw i16 [[INP]], -1098; CHECK-NEXT:    [[TMP1:%.*]] = uitofp i16 [[ADD]] to float99; CHECK-NEXT:    [[TMP2:%.*]] = fadd float [[TMP1]], 2.000000e+00100; CHECK-NEXT:    [[TMP3:%.*]] = sitofp i16 [[ADD]] to float101; CHECK-NEXT:    [[TMP4:%.*]] = fneg float [[TMP3]]102; CHECK-NEXT:    [[TMP5:%.*]] = insertelement <2 x float> poison, float [[TMP2]], i64 0103; CHECK-NEXT:    [[R:%.*]] = insertelement <2 x float> [[TMP5]], float [[TMP4]], i64 1104; CHECK-NEXT:    ret <2 x float> [[R]]105;106  %add = add nsw i16 %inp, -10107  %1 = uitofp i16 %add to float108  %2 = fadd float %1, 2.000000e+00109  %3 = sitofp i16 %add to float110  %4 = fneg float %3111  %5 = insertelement <2 x float> poison, float %2, i64 0112  %r = insertelement <2 x float> %5, float %4, i64 1113  ret <2 x float> %r114}115 116define <2 x i32> @replace_through_int_casts(i16 %inp, <2 x i16> %dead) {117; CHECK-LABEL: define <2 x i32> @replace_through_int_casts(118; CHECK-SAME: i16 [[INP:%.*]], <2 x i16> [[DEAD:%.*]]) {119; CHECK-NEXT:    [[ADD:%.*]] = add nsw i16 [[INP]], -10120; CHECK-NEXT:    [[TMP1:%.*]] = zext i16 [[INP]] to i32121; CHECK-NEXT:    [[TMP2:%.*]] = sext i16 [[ADD]] to i32122; CHECK-NEXT:    [[TMP3:%.*]] = insertelement <2 x i32> poison, i32 [[TMP1]], i64 0123; CHECK-NEXT:    [[R:%.*]] = insertelement <2 x i32> [[TMP3]], i32 [[TMP2]], i64 1124; CHECK-NEXT:    ret <2 x i32> [[R]]125;126  %add = add nsw i16 %inp, -10127  %1 = zext i16 %inp to i32128  %2 = sext i16 %add to i32129  %3 = insertelement <2 x i32> poison, i32 %1, i64 0130  %r = insertelement <2 x i32> %3, i32 %2, i64 1131  ret <2 x i32> %r132}133 134define <2 x i32> @replace_through_int_casts_ele0_only(i16 %inp, <2 x i16> %dead) {135; CHECK-LABEL: define <2 x i32> @replace_through_int_casts_ele0_only(136; CHECK-SAME: i16 [[INP:%.*]], <2 x i16> [[DEAD:%.*]]) {137; CHECK-NEXT:    [[TMP1:%.*]] = sext i16 [[INP]] to i32138; CHECK-NEXT:    [[TMP2:%.*]] = zext i16 [[INP]] to i32139; CHECK-NEXT:    [[TMP3:%.*]] = insertelement <2 x i32> poison, i32 [[TMP2]], i64 0140; CHECK-NEXT:    [[R:%.*]] = insertelement <2 x i32> [[TMP3]], i32 [[TMP1]], i64 1141; CHECK-NEXT:    ret <2 x i32> [[R]]142;143  %2 = sext i16 %inp to i32144  %4 = zext i16 %inp to i32145  %5 = insertelement <2 x i32> poison, i32 %4, i64 0146  %r = insertelement <2 x i32> %5, i32 %2, i64 1147  ret <2 x i32> %r148}149 150define <2 x i8> @replace_through_binop_fail_cant_speculate(i8 %inp, <2 x i8> %d, <2 x i8> %any) {151; CHECK-LABEL: define <2 x i8> @replace_through_binop_fail_cant_speculate(152; CHECK-SAME: i8 [[INP:%.*]], <2 x i8> [[D:%.*]], <2 x i8> [[ANY:%.*]]) {153; CHECK-NEXT:    [[TMP3:%.*]] = insertelement <2 x i8> poison, i8 [[INP]], i32 0154; CHECK-NEXT:    [[TMP2:%.*]] = shufflevector <2 x i8> [[TMP3]], <2 x i8> poison, <2 x i32> zeroinitializer155; CHECK-NEXT:    [[V:%.*]] = add <2 x i8> [[TMP2]], <i8 0, i8 5>156; CHECK-NEXT:    [[DIV0:%.*]] = sdiv <2 x i8> splat (i8 -128), [[V]]157; CHECK-NEXT:    [[TMP1:%.*]] = xor i8 [[INP]], 123158; CHECK-NEXT:    [[R:%.*]] = insertelement <2 x i8> [[DIV0]], i8 [[TMP1]], i64 0159; CHECK-NEXT:    ret <2 x i8> [[R]]160;161  %add = add i8 %inp, 5162  %v0 = insertelement <2 x i8> poison, i8 %inp, i64 0163  %v = insertelement <2 x i8> %v0, i8 %add, i64 1164  %div0 = sdiv <2 x i8> <i8 -128, i8 -128>, %v165  %1 = xor i8 %inp, 123166  %r = insertelement <2 x i8> %div0, i8 %1, i64 0167  ret <2 x i8> %r168}169 170define <2 x i8> @replace_through_binop_preserve_flags(i8 %inp, <2 x i8> %d, <2 x i8> %any) {171; CHECK-LABEL: define <2 x i8> @replace_through_binop_preserve_flags(172; CHECK-SAME: i8 [[INP:%.*]], <2 x i8> [[D:%.*]], <2 x i8> [[ANY:%.*]]) {173; CHECK-NEXT:    [[ADD:%.*]] = xor i8 [[INP]], 5174; CHECK-NEXT:    [[TMP1:%.*]] = xor i8 [[INP]], 123175; CHECK-NEXT:    [[TMP2:%.*]] = add nsw i8 [[ADD]], 1176; CHECK-NEXT:    [[TMP3:%.*]] = insertelement <2 x i8> poison, i8 [[TMP1]], i64 0177; CHECK-NEXT:    [[R:%.*]] = insertelement <2 x i8> [[TMP3]], i8 [[TMP2]], i64 1178; CHECK-NEXT:    ret <2 x i8> [[R]]179;180  %add = xor i8 %inp, 5181  %1 = xor i8 %inp, 123182  %2 = add nsw i8 %add, 1183  %3 = insertelement <2 x i8> poison, i8 %1, i64 0184  %r = insertelement <2 x i8> %3, i8 %2, i64 1185  ret <2 x i8> %r186}187