114 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes=instcombine -mtriple=x86_64-unknown-unknown -S | FileCheck %s3target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"4 5define i16 @test1(float %f) {6;7; CHECK-LABEL: @test1(8; CHECK-NEXT: [[TMP1:%.*]] = fadd float [[F:%.*]], -1.000000e+009; CHECK-NEXT: [[TMP2:%.*]] = fmul float [[TMP1]], 5.000000e-0110; CHECK-NEXT: [[TMP3:%.*]] = insertelement <4 x float> poison, float [[TMP2]], i64 011; CHECK-NEXT: [[TMP48:%.*]] = tail call <4 x float> @llvm.x86.sse.min.ss(<4 x float> [[TMP3]], <4 x float> <float 6.553500e+04, float poison, float poison, float poison>)12; CHECK-NEXT: [[TMP59:%.*]] = tail call <4 x float> @llvm.x86.sse.max.ss(<4 x float> [[TMP48]], <4 x float> <float 0.000000e+00, float poison, float poison, float poison>)13; CHECK-NEXT: [[TMP_UPGRD_1:%.*]] = tail call i32 @llvm.x86.sse.cvttss2si(<4 x float> [[TMP59]])14; CHECK-NEXT: [[TMP69:%.*]] = trunc i32 [[TMP_UPGRD_1]] to i1615; CHECK-NEXT: ret i16 [[TMP69]]16;17 %tmp = insertelement <4 x float> poison, float %f, i32 018 %tmp10 = insertelement <4 x float> %tmp, float 0.000000e+00, i32 119 %tmp11 = insertelement <4 x float> %tmp10, float 0.000000e+00, i32 220 %tmp12 = insertelement <4 x float> %tmp11, float 0.000000e+00, i32 321 %tmp28 = tail call <4 x float> @llvm.x86.sse.sub.ss( <4 x float> %tmp12, <4 x float> < float 1.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00 > )22 %tmp37 = tail call <4 x float> @llvm.x86.sse.mul.ss( <4 x float> %tmp28, <4 x float> < float 5.000000e-01, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00 > )23 %tmp48 = tail call <4 x float> @llvm.x86.sse.min.ss( <4 x float> %tmp37, <4 x float> < float 6.553500e+04, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00 > )24 %tmp59 = tail call <4 x float> @llvm.x86.sse.max.ss( <4 x float> %tmp48, <4 x float> zeroinitializer )25 %tmp.upgrd.1 = tail call i32 @llvm.x86.sse.cvttss2si( <4 x float> %tmp59 )26 %tmp69 = trunc i32 %tmp.upgrd.1 to i1627 ret i16 %tmp6928}29 30define i64 @test3(float %f, double %d) {31;32; CHECK-LABEL: @test3(33; CHECK-NEXT: [[V03:%.*]] = insertelement <4 x float> poison, float [[F:%.*]], i64 034; CHECK-NEXT: [[TMP0:%.*]] = tail call i32 @llvm.x86.sse.cvtss2si(<4 x float> [[V03]])35; CHECK-NEXT: [[V13:%.*]] = insertelement <4 x float> poison, float [[F]], i64 036; CHECK-NEXT: [[TMP1:%.*]] = tail call i64 @llvm.x86.sse.cvtss2si64(<4 x float> [[V13]])37; CHECK-NEXT: [[V23:%.*]] = insertelement <4 x float> poison, float [[F]], i64 038; CHECK-NEXT: [[TMP2:%.*]] = tail call i32 @llvm.x86.sse.cvttss2si(<4 x float> [[V23]])39; CHECK-NEXT: [[V33:%.*]] = insertelement <4 x float> poison, float [[F]], i64 040; CHECK-NEXT: [[TMP3:%.*]] = tail call i64 @llvm.x86.sse.cvttss2si64(<4 x float> [[V33]])41; CHECK-NEXT: [[V41:%.*]] = insertelement <2 x double> poison, double [[D:%.*]], i64 042; CHECK-NEXT: [[TMP4:%.*]] = tail call i32 @llvm.x86.sse2.cvtsd2si(<2 x double> [[V41]])43; CHECK-NEXT: [[V51:%.*]] = insertelement <2 x double> poison, double [[D]], i64 044; CHECK-NEXT: [[TMP5:%.*]] = tail call i64 @llvm.x86.sse2.cvtsd2si64(<2 x double> [[V51]])45; CHECK-NEXT: [[V61:%.*]] = insertelement <2 x double> poison, double [[D]], i64 046; CHECK-NEXT: [[TMP6:%.*]] = tail call i32 @llvm.x86.sse2.cvttsd2si(<2 x double> [[V61]])47; CHECK-NEXT: [[V71:%.*]] = insertelement <2 x double> poison, double [[D]], i64 048; CHECK-NEXT: [[TMP7:%.*]] = tail call i64 @llvm.x86.sse2.cvttsd2si64(<2 x double> [[V71]])49; CHECK-NEXT: [[TMP8:%.*]] = add i32 [[TMP0]], [[TMP2]]50; CHECK-NEXT: [[TMP9:%.*]] = add i32 [[TMP4]], [[TMP6]]51; CHECK-NEXT: [[TMP10:%.*]] = add i32 [[TMP8]], [[TMP9]]52; CHECK-NEXT: [[TMP11:%.*]] = sext i32 [[TMP10]] to i6453; CHECK-NEXT: [[TMP12:%.*]] = add i64 [[TMP1]], [[TMP3]]54; CHECK-NEXT: [[TMP13:%.*]] = add i64 [[TMP5]], [[TMP7]]55; CHECK-NEXT: [[TMP14:%.*]] = add i64 [[TMP12]], [[TMP13]]56; CHECK-NEXT: [[TMP15:%.*]] = add i64 [[TMP14]], [[TMP11]]57; CHECK-NEXT: ret i64 [[TMP15]]58;59 %v00 = insertelement <4 x float> poison, float %f, i32 060 %v01 = insertelement <4 x float> %v00, float 0.000000e+00, i32 161 %v02 = insertelement <4 x float> %v01, float 0.000000e+00, i32 262 %v03 = insertelement <4 x float> %v02, float 0.000000e+00, i32 363 %tmp0 = tail call i32 @llvm.x86.sse.cvtss2si(<4 x float> %v03)64 %v10 = insertelement <4 x float> poison, float %f, i32 065 %v11 = insertelement <4 x float> %v10, float 0.000000e+00, i32 166 %v12 = insertelement <4 x float> %v11, float 0.000000e+00, i32 267 %v13 = insertelement <4 x float> %v12, float 0.000000e+00, i32 368 %tmp1 = tail call i64 @llvm.x86.sse.cvtss2si64(<4 x float> %v13)69 %v20 = insertelement <4 x float> poison, float %f, i32 070 %v21 = insertelement <4 x float> %v20, float 0.000000e+00, i32 171 %v22 = insertelement <4 x float> %v21, float 0.000000e+00, i32 272 %v23 = insertelement <4 x float> %v22, float 0.000000e+00, i32 373 %tmp2 = tail call i32 @llvm.x86.sse.cvttss2si(<4 x float> %v23)74 %v30 = insertelement <4 x float> poison, float %f, i32 075 %v31 = insertelement <4 x float> %v30, float 0.000000e+00, i32 176 %v32 = insertelement <4 x float> %v31, float 0.000000e+00, i32 277 %v33 = insertelement <4 x float> %v32, float 0.000000e+00, i32 378 %tmp3 = tail call i64 @llvm.x86.sse.cvttss2si64(<4 x float> %v33)79 %v40 = insertelement <2 x double> poison, double %d, i32 080 %v41 = insertelement <2 x double> %v40, double 0.000000e+00, i32 181 %tmp4 = tail call i32 @llvm.x86.sse2.cvtsd2si(<2 x double> %v41)82 %v50 = insertelement <2 x double> poison, double %d, i32 083 %v51 = insertelement <2 x double> %v50, double 0.000000e+00, i32 184 %tmp5 = tail call i64 @llvm.x86.sse2.cvtsd2si64(<2 x double> %v51)85 %v60 = insertelement <2 x double> poison, double %d, i32 086 %v61 = insertelement <2 x double> %v60, double 0.000000e+00, i32 187 %tmp6 = tail call i32 @llvm.x86.sse2.cvttsd2si(<2 x double> %v61)88 %v70 = insertelement <2 x double> poison, double %d, i32 089 %v71 = insertelement <2 x double> %v70, double 0.000000e+00, i32 190 %tmp7 = tail call i64 @llvm.x86.sse2.cvttsd2si64(<2 x double> %v71)91 %tmp8 = add i32 %tmp0, %tmp292 %tmp9 = add i32 %tmp4, %tmp693 %tmp10 = add i32 %tmp8, %tmp994 %tmp11 = sext i32 %tmp10 to i6495 %tmp12 = add i64 %tmp1, %tmp396 %tmp13 = add i64 %tmp5, %tmp797 %tmp14 = add i64 %tmp12, %tmp1398 %tmp15 = add i64 %tmp11, %tmp1499 ret i64 %tmp15100}101 102declare <4 x float> @llvm.x86.sse.sub.ss(<4 x float>, <4 x float>)103declare <4 x float> @llvm.x86.sse.mul.ss(<4 x float>, <4 x float>)104declare <4 x float> @llvm.x86.sse.min.ss(<4 x float>, <4 x float>)105declare <4 x float> @llvm.x86.sse.max.ss(<4 x float>, <4 x float>)106declare i32 @llvm.x86.sse.cvtss2si(<4 x float>)107declare i64 @llvm.x86.sse.cvtss2si64(<4 x float>)108declare i32 @llvm.x86.sse.cvttss2si(<4 x float>)109declare i64 @llvm.x86.sse.cvttss2si64(<4 x float>)110declare i32 @llvm.x86.sse2.cvtsd2si(<2 x double>)111declare i64 @llvm.x86.sse2.cvtsd2si64(<2 x double>)112declare i32 @llvm.x86.sse2.cvttsd2si(<2 x double>)113declare i64 @llvm.x86.sse2.cvttsd2si64(<2 x double>)114