1*9880d681SAndroid Build Coastguard Worker; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -instcombine -S | FileCheck %s 3*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 4*9880d681SAndroid Build Coastguard Worker 5*9880d681SAndroid Build Coastguard Workerdefine <2 x double> @test_round_sd(<2 x double> %a, <2 x double> %b) { 6*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_round_sd( 7*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: [[TMP1:%.*]] = tail call <2 x double> @llvm.x86.sse41.round.sd(<2 x double> %a, <2 x double> %b, i32 10) 8*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret <2 x double> [[TMP1]] 9*9880d681SAndroid Build Coastguard Worker; 10*9880d681SAndroid Build Coastguard Worker %1 = insertelement <2 x double> %a, double 1.000000e+00, i32 0 11*9880d681SAndroid Build Coastguard Worker %2 = insertelement <2 x double> %b, double 2.000000e+00, i32 1 12*9880d681SAndroid Build Coastguard Worker %3 = tail call <2 x double> @llvm.x86.sse41.round.sd(<2 x double> %1, <2 x double> %2, i32 10) 13*9880d681SAndroid Build Coastguard Worker ret <2 x double> %3 14*9880d681SAndroid Build Coastguard Worker} 15*9880d681SAndroid Build Coastguard Worker 16*9880d681SAndroid Build Coastguard Workerdefine double @test_round_sd_0(double %a, double %b) { 17*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_round_sd_0( 18*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x double> undef, double %b, i32 0 19*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: [[TMP2:%.*]] = tail call <2 x double> @llvm.x86.sse41.round.sd(<2 x double> undef, <2 x double> [[TMP1]], i32 10) 20*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: [[TMP3:%.*]] = extractelement <2 x double> [[TMP2]], i32 0 21*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret double [[TMP3]] 22*9880d681SAndroid Build Coastguard Worker; 23*9880d681SAndroid Build Coastguard Worker %1 = insertelement <2 x double> undef, double %a, i32 0 24*9880d681SAndroid Build Coastguard Worker %2 = insertelement <2 x double> %1, double 1.000000e+00, i32 1 25*9880d681SAndroid Build Coastguard Worker %3 = insertelement <2 x double> undef, double %b, i32 0 26*9880d681SAndroid Build Coastguard Worker %4 = insertelement <2 x double> %3, double 2.000000e+00, i32 1 27*9880d681SAndroid Build Coastguard Worker %5 = tail call <2 x double> @llvm.x86.sse41.round.sd(<2 x double> %2, <2 x double> %4, i32 10) 28*9880d681SAndroid Build Coastguard Worker %6 = extractelement <2 x double> %5, i32 0 29*9880d681SAndroid Build Coastguard Worker ret double %6 30*9880d681SAndroid Build Coastguard Worker} 31*9880d681SAndroid Build Coastguard Worker 32*9880d681SAndroid Build Coastguard Workerdefine double @test_round_sd_1(double %a, double %b) { 33*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_round_sd_1( 34*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret double 1.000000e+00 35*9880d681SAndroid Build Coastguard Worker; 36*9880d681SAndroid Build Coastguard Worker %1 = insertelement <2 x double> undef, double %a, i32 0 37*9880d681SAndroid Build Coastguard Worker %2 = insertelement <2 x double> %1, double 1.000000e+00, i32 1 38*9880d681SAndroid Build Coastguard Worker %3 = insertelement <2 x double> undef, double %b, i32 0 39*9880d681SAndroid Build Coastguard Worker %4 = insertelement <2 x double> %3, double 2.000000e+00, i32 1 40*9880d681SAndroid Build Coastguard Worker %5 = tail call <2 x double> @llvm.x86.sse41.round.sd(<2 x double> %2, <2 x double> %4, i32 10) 41*9880d681SAndroid Build Coastguard Worker %6 = extractelement <2 x double> %5, i32 1 42*9880d681SAndroid Build Coastguard Worker ret double %6 43*9880d681SAndroid Build Coastguard Worker} 44*9880d681SAndroid Build Coastguard Worker 45*9880d681SAndroid Build Coastguard Workerdefine <4 x float> @test_round_ss(<4 x float> %a, <4 x float> %b) { 46*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_round_ss( 47*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: [[TMP1:%.*]] = tail call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> <float undef, float 1.000000e+00, float 2.000000e+00, float 3.000000e+00>, <4 x float> %b, i32 10) 48*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret <4 x float> [[TMP1]] 49*9880d681SAndroid Build Coastguard Worker; 50*9880d681SAndroid Build Coastguard Worker %1 = insertelement <4 x float> %a, float 1.000000e+00, i32 1 51*9880d681SAndroid Build Coastguard Worker %2 = insertelement <4 x float> %1, float 2.000000e+00, i32 2 52*9880d681SAndroid Build Coastguard Worker %3 = insertelement <4 x float> %2, float 3.000000e+00, i32 3 53*9880d681SAndroid Build Coastguard Worker %4 = insertelement <4 x float> %b, float 1.000000e+00, i32 1 54*9880d681SAndroid Build Coastguard Worker %5 = insertelement <4 x float> %4, float 2.000000e+00, i32 2 55*9880d681SAndroid Build Coastguard Worker %6 = insertelement <4 x float> %5, float 3.000000e+00, i32 3 56*9880d681SAndroid Build Coastguard Worker %7 = tail call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %3, <4 x float> %6, i32 10) 57*9880d681SAndroid Build Coastguard Worker ret <4 x float> %7 58*9880d681SAndroid Build Coastguard Worker} 59*9880d681SAndroid Build Coastguard Worker 60*9880d681SAndroid Build Coastguard Workerdefine float @test_round_ss_0(float %a, float %b) { 61*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_round_ss_0( 62*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: [[TMP1:%.*]] = insertelement <4 x float> undef, float %b, i32 0 63*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: [[TMP2:%.*]] = tail call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> undef, <4 x float> [[TMP1]], i32 10) 64*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: [[R:%.*]] = extractelement <4 x float> [[TMP2]], i32 0 65*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret float [[R]] 66*9880d681SAndroid Build Coastguard Worker; 67*9880d681SAndroid Build Coastguard Worker %1 = insertelement <4 x float> undef, float %a, i32 0 68*9880d681SAndroid Build Coastguard Worker %2 = insertelement <4 x float> %1, float 1.000000e+00, i32 1 69*9880d681SAndroid Build Coastguard Worker %3 = insertelement <4 x float> %2, float 2.000000e+00, i32 2 70*9880d681SAndroid Build Coastguard Worker %4 = insertelement <4 x float> %3, float 3.000000e+00, i32 3 71*9880d681SAndroid Build Coastguard Worker %5 = insertelement <4 x float> undef, float %b, i32 0 72*9880d681SAndroid Build Coastguard Worker %6 = insertelement <4 x float> %5, float 4.000000e+00, i32 1 73*9880d681SAndroid Build Coastguard Worker %7 = insertelement <4 x float> %6, float 5.000000e+00, i32 2 74*9880d681SAndroid Build Coastguard Worker %8 = insertelement <4 x float> %7, float 6.000000e+00, i32 3 75*9880d681SAndroid Build Coastguard Worker %9 = tail call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %4, <4 x float> %8, i32 10) 76*9880d681SAndroid Build Coastguard Worker %r = extractelement <4 x float> %9, i32 0 77*9880d681SAndroid Build Coastguard Worker ret float %r 78*9880d681SAndroid Build Coastguard Worker} 79*9880d681SAndroid Build Coastguard Worker 80*9880d681SAndroid Build Coastguard Workerdefine float @test_round_ss_2(float %a, float %b) { 81*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_round_ss_2( 82*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret float 2.000000e+00 83*9880d681SAndroid Build Coastguard Worker; 84*9880d681SAndroid Build Coastguard Worker %1 = insertelement <4 x float> undef, float %a, i32 0 85*9880d681SAndroid Build Coastguard Worker %2 = insertelement <4 x float> %1, float 1.000000e+00, i32 1 86*9880d681SAndroid Build Coastguard Worker %3 = insertelement <4 x float> %2, float 2.000000e+00, i32 2 87*9880d681SAndroid Build Coastguard Worker %4 = insertelement <4 x float> %3, float 3.000000e+00, i32 3 88*9880d681SAndroid Build Coastguard Worker %5 = insertelement <4 x float> undef, float %b, i32 0 89*9880d681SAndroid Build Coastguard Worker %6 = insertelement <4 x float> %5, float 4.000000e+00, i32 1 90*9880d681SAndroid Build Coastguard Worker %7 = insertelement <4 x float> %6, float 5.000000e+00, i32 2 91*9880d681SAndroid Build Coastguard Worker %8 = insertelement <4 x float> %7, float 6.000000e+00, i32 3 92*9880d681SAndroid Build Coastguard Worker %9 = tail call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %4, <4 x float> %8, i32 10) 93*9880d681SAndroid Build Coastguard Worker %r = extractelement <4 x float> %9, i32 2 94*9880d681SAndroid Build Coastguard Worker ret float %r 95*9880d681SAndroid Build Coastguard Worker} 96*9880d681SAndroid Build Coastguard Worker 97*9880d681SAndroid Build Coastguard Workerdeclare <2 x double> @llvm.x86.sse41.round.sd(<2 x double>, <2 x double>, i32) nounwind readnone 98*9880d681SAndroid Build Coastguard Workerdeclare <4 x float> @llvm.x86.sse41.round.ss(<4 x float>, <4 x float>, i32) nounwind readnone 99