brintos

brintos / llvm-project-archived public Read only

0
0
Text · 14.6 KiB · d4ee16a Raw
344 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 52; RUN: opt -S  -dxil-intrinsic-expansion  < %s | FileCheck %s3 4; Make sure dxil operation function calls for lvm.vector.reduce.fadd and lvm.vector.reduce.add are generate.5 6define noundef half @test_length_half2(<2 x half> noundef %p0) {7; CHECK-LABEL: define noundef half @test_length_half2(8; CHECK-SAME: <2 x half> noundef [[P0:%.*]]) {9; CHECK-NEXT:  [[ENTRY:.*:]]10; CHECK-NEXT:    [[TMP0:%.*]] = extractelement <2 x half> [[P0]], i64 011; CHECK-NEXT:    [[TMP1:%.*]] = extractelement <2 x half> [[P0]], i64 112; CHECK-NEXT:    [[TMP2:%.*]] = fadd half [[TMP0]], [[TMP1]]13; CHECK-NEXT:    ret half [[TMP2]]14;15entry:16  %rdx.fadd = call half @llvm.vector.reduce.fadd.v2f16(half 0xH0000, <2 x half> %p0)17  ret half %rdx.fadd18}19 20define noundef half @test_length_half2_start1(<2 x half> noundef %p0) {21; CHECK-LABEL: define noundef half @test_length_half2_start1(22; CHECK-SAME: <2 x half> noundef [[P0:%.*]]) {23; CHECK-NEXT:  [[ENTRY:.*:]]24; CHECK-NEXT:    [[TMP0:%.*]] = extractelement <2 x half> [[P0]], i64 025; CHECK-NEXT:    [[TMP1:%.*]] = fadd half [[TMP0]], 0xH000126; CHECK-NEXT:    [[TMP2:%.*]] = extractelement <2 x half> [[P0]], i64 127; CHECK-NEXT:    [[TMP3:%.*]] = fadd half [[TMP1]], [[TMP2]]28; CHECK-NEXT:    ret half [[TMP3]]29;30entry:31  %rdx.fadd = call half @llvm.vector.reduce.fadd.v2f16(half 0xH0001, <2 x half> %p0)32  ret half %rdx.fadd33}34 35define noundef half @test_length_half3(<3 x half> noundef %p0) {36; CHECK-LABEL: define noundef half @test_length_half3(37; CHECK-SAME: <3 x half> noundef [[P0:%.*]]) {38; CHECK-NEXT:  [[ENTRY:.*:]]39; CHECK-NEXT:    [[TMP0:%.*]] = extractelement <3 x half> [[P0]], i64 040; CHECK-NEXT:    [[TMP1:%.*]] = extractelement <3 x half> [[P0]], i64 141; CHECK-NEXT:    [[TMP2:%.*]] = fadd half [[TMP0]], [[TMP1]]42; CHECK-NEXT:    [[TMP3:%.*]] = extractelement <3 x half> [[P0]], i64 243; CHECK-NEXT:    [[TMP4:%.*]] = fadd half [[TMP2]], [[TMP3]]44; CHECK-NEXT:    ret half [[TMP4]]45;46entry:47  %rdx.fadd = call half @llvm.vector.reduce.fadd.v3f16(half 0xH0000, <3 x half> %p0)48  ret half %rdx.fadd49}50 51define noundef half @test_length_half4(<4 x half> noundef %p0) {52; CHECK-LABEL: define noundef half @test_length_half4(53; CHECK-SAME: <4 x half> noundef [[P0:%.*]]) {54; CHECK-NEXT:  [[ENTRY:.*:]]55; CHECK-NEXT:    [[TMP0:%.*]] = extractelement <4 x half> [[P0]], i64 056; CHECK-NEXT:    [[TMP1:%.*]] = extractelement <4 x half> [[P0]], i64 157; CHECK-NEXT:    [[TMP2:%.*]] = fadd half [[TMP0]], [[TMP1]]58; CHECK-NEXT:    [[TMP3:%.*]] = extractelement <4 x half> [[P0]], i64 259; CHECK-NEXT:    [[TMP4:%.*]] = fadd half [[TMP2]], [[TMP3]]60; CHECK-NEXT:    [[TMP5:%.*]] = extractelement <4 x half> [[P0]], i64 361; CHECK-NEXT:    [[TMP6:%.*]] = fadd half [[TMP4]], [[TMP5]]62; CHECK-NEXT:    ret half [[TMP6]]63;64entry:65  %rdx.fadd = call half @llvm.vector.reduce.fadd.v4f16(half 0xH0000, <4 x half> %p0)66  ret half %rdx.fadd67}68 69define noundef float @test_length_float2(<2 x float> noundef %p0) {70; CHECK-LABEL: define noundef float @test_length_float2(71; CHECK-SAME: <2 x float> noundef [[P0:%.*]]) {72; CHECK-NEXT:  [[ENTRY:.*:]]73; CHECK-NEXT:    [[TMP0:%.*]] = extractelement <2 x float> [[P0]], i64 074; CHECK-NEXT:    [[TMP1:%.*]] = extractelement <2 x float> [[P0]], i64 175; CHECK-NEXT:    [[TMP2:%.*]] = fadd float [[TMP0]], [[TMP1]]76; CHECK-NEXT:    ret float [[TMP2]]77;78entry:79  %rdx.fadd = call float @llvm.vector.reduce.fadd.v2f32(float 0.000000e+00, <2 x float> %p0)80  ret float %rdx.fadd81}82 83define noundef float @test_length_float3(<3 x float> noundef %p0) {84; CHECK-LABEL: define noundef float @test_length_float3(85; CHECK-SAME: <3 x float> noundef [[P0:%.*]]) {86; CHECK-NEXT:  [[ENTRY:.*:]]87; CHECK-NEXT:    [[TMP0:%.*]] = extractelement <3 x float> [[P0]], i64 088; CHECK-NEXT:    [[TMP1:%.*]] = extractelement <3 x float> [[P0]], i64 189; CHECK-NEXT:    [[TMP2:%.*]] = fadd float [[TMP0]], [[TMP1]]90; CHECK-NEXT:    [[TMP3:%.*]] = extractelement <3 x float> [[P0]], i64 291; CHECK-NEXT:    [[TMP4:%.*]] = fadd float [[TMP2]], [[TMP3]]92; CHECK-NEXT:    ret float [[TMP4]]93;94entry:95  %rdx.fadd = call float @llvm.vector.reduce.fadd.v3f32(float 0.000000e+00, <3 x float> %p0)96  ret float %rdx.fadd97}98 99define noundef float @test_length_float3_start1(<3 x float> noundef %p0) {100; CHECK-LABEL: define noundef float @test_length_float3_start1(101; CHECK-SAME: <3 x float> noundef [[P0:%.*]]) {102; CHECK-NEXT:  [[ENTRY:.*:]]103; CHECK-NEXT:    [[TMP0:%.*]] = extractelement <3 x float> [[P0]], i64 0104; CHECK-NEXT:    [[TMP1:%.*]] = fadd float [[TMP0]], 1.000000e+00105; CHECK-NEXT:    [[TMP2:%.*]] = extractelement <3 x float> [[P0]], i64 1106; CHECK-NEXT:    [[TMP3:%.*]] = fadd float [[TMP1]], [[TMP2]]107; CHECK-NEXT:    [[TMP4:%.*]] = extractelement <3 x float> [[P0]], i64 2108; CHECK-NEXT:    [[TMP5:%.*]] = fadd float [[TMP3]], [[TMP4]]109; CHECK-NEXT:    ret float [[TMP5]]110;111entry:112  %rdx.fadd = call float @llvm.vector.reduce.fadd.v3f32(float 1.000000e+00, <3 x float> %p0)113  ret float %rdx.fadd114}115 116define noundef float @test_length_float4(<4 x float> noundef %p0) {117; CHECK-LABEL: define noundef float @test_length_float4(118; CHECK-SAME: <4 x float> noundef [[P0:%.*]]) {119; CHECK-NEXT:  [[ENTRY:.*:]]120; CHECK-NEXT:    [[TMP0:%.*]] = extractelement <4 x float> [[P0]], i64 0121; CHECK-NEXT:    [[TMP1:%.*]] = extractelement <4 x float> [[P0]], i64 1122; CHECK-NEXT:    [[TMP2:%.*]] = fadd float [[TMP0]], [[TMP1]]123; CHECK-NEXT:    [[TMP3:%.*]] = extractelement <4 x float> [[P0]], i64 2124; CHECK-NEXT:    [[TMP4:%.*]] = fadd float [[TMP2]], [[TMP3]]125; CHECK-NEXT:    [[TMP5:%.*]] = extractelement <4 x float> [[P0]], i64 3126; CHECK-NEXT:    [[TMP6:%.*]] = fadd float [[TMP4]], [[TMP5]]127; CHECK-NEXT:    ret float [[TMP6]]128;129entry:130  %rdx.fadd = call float @llvm.vector.reduce.fadd.v4f32(float 0.000000e+00, <4 x float> %p0)131  ret float %rdx.fadd132}133 134define noundef double @test_length_double2(<2 x double> noundef %p0) {135; CHECK-LABEL: define noundef double @test_length_double2(136; CHECK-SAME: <2 x double> noundef [[P0:%.*]]) {137; CHECK-NEXT:  [[ENTRY:.*:]]138; CHECK-NEXT:    [[TMP0:%.*]] = extractelement <2 x double> [[P0]], i64 0139; CHECK-NEXT:    [[TMP1:%.*]] = extractelement <2 x double> [[P0]], i64 1140; CHECK-NEXT:    [[TMP2:%.*]] = fadd double [[TMP0]], [[TMP1]]141; CHECK-NEXT:    ret double [[TMP2]]142;143entry:144  %rdx.fadd = call double @llvm.vector.reduce.fadd.v2f64(double 0.000000e+00, <2 x double> %p0)145  ret double %rdx.fadd146}147 148define noundef double @test_length_double3(<3 x double> noundef %p0) {149; CHECK-LABEL: define noundef double @test_length_double3(150; CHECK-SAME: <3 x double> noundef [[P0:%.*]]) {151; CHECK-NEXT:  [[ENTRY:.*:]]152; CHECK-NEXT:    [[TMP0:%.*]] = extractelement <3 x double> [[P0]], i64 0153; CHECK-NEXT:    [[TMP1:%.*]] = extractelement <3 x double> [[P0]], i64 1154; CHECK-NEXT:    [[TMP2:%.*]] = fadd double [[TMP0]], [[TMP1]]155; CHECK-NEXT:    [[TMP3:%.*]] = extractelement <3 x double> [[P0]], i64 2156; CHECK-NEXT:    [[TMP4:%.*]] = fadd double [[TMP2]], [[TMP3]]157; CHECK-NEXT:    ret double [[TMP4]]158;159entry:160  %rdx.fadd = call double @llvm.vector.reduce.fadd.v3f64(double 0.000000e+00, <3 x double> %p0)161  ret double %rdx.fadd162}163 164define noundef double @test_length_double4(<4 x double> noundef %p0) {165; CHECK-LABEL: define noundef double @test_length_double4(166; CHECK-SAME: <4 x double> noundef [[P0:%.*]]) {167; CHECK-NEXT:  [[ENTRY:.*:]]168; CHECK-NEXT:    [[TMP0:%.*]] = extractelement <4 x double> [[P0]], i64 0169; CHECK-NEXT:    [[TMP1:%.*]] = extractelement <4 x double> [[P0]], i64 1170; CHECK-NEXT:    [[TMP2:%.*]] = fadd double [[TMP0]], [[TMP1]]171; CHECK-NEXT:    [[TMP3:%.*]] = extractelement <4 x double> [[P0]], i64 2172; CHECK-NEXT:    [[TMP4:%.*]] = fadd double [[TMP2]], [[TMP3]]173; CHECK-NEXT:    [[TMP5:%.*]] = extractelement <4 x double> [[P0]], i64 3174; CHECK-NEXT:    [[TMP6:%.*]] = fadd double [[TMP4]], [[TMP5]]175; CHECK-NEXT:    ret double [[TMP6]]176;177entry:178  %rdx.fadd = call double @llvm.vector.reduce.fadd.v4f64(double 0.000000e+00, <4 x double> %p0)179  ret double %rdx.fadd180}181 182define noundef double @test_length_double4_start1(<4 x double> noundef %p0) {183; CHECK-LABEL: define noundef double @test_length_double4_start1(184; CHECK-SAME: <4 x double> noundef [[P0:%.*]]) {185; CHECK-NEXT:  [[ENTRY:.*:]]186; CHECK-NEXT:    [[TMP0:%.*]] = extractelement <4 x double> [[P0]], i64 0187; CHECK-NEXT:    [[TMP1:%.*]] = fadd double [[TMP0]], 1.000000e+00188; CHECK-NEXT:    [[TMP2:%.*]] = extractelement <4 x double> [[P0]], i64 1189; CHECK-NEXT:    [[TMP3:%.*]] = fadd double [[TMP1]], [[TMP2]]190; CHECK-NEXT:    [[TMP4:%.*]] = extractelement <4 x double> [[P0]], i64 2191; CHECK-NEXT:    [[TMP5:%.*]] = fadd double [[TMP3]], [[TMP4]]192; CHECK-NEXT:    [[TMP6:%.*]] = extractelement <4 x double> [[P0]], i64 3193; CHECK-NEXT:    [[TMP7:%.*]] = fadd double [[TMP5]], [[TMP6]]194; CHECK-NEXT:    ret double [[TMP7]]195;196entry:197  %rdx.fadd = call double @llvm.vector.reduce.fadd.v4f64(double 1.000000e+00, <4 x double> %p0)198  ret double %rdx.fadd199}200 201define noundef i16 @test_length_short2(<2 x i16> noundef %p0) {202; CHECK-LABEL: define noundef i16 @test_length_short2(203; CHECK-SAME: <2 x i16> noundef [[P0:%.*]]) {204; CHECK-NEXT:  [[ENTRY:.*:]]205; CHECK-NEXT:    [[TMP0:%.*]] = extractelement <2 x i16> [[P0]], i64 0206; CHECK-NEXT:    [[TMP1:%.*]] = extractelement <2 x i16> [[P0]], i64 1207; CHECK-NEXT:    [[TMP2:%.*]] = add i16 [[TMP0]], [[TMP1]]208; CHECK-NEXT:    ret i16 [[TMP2]]209;210entry:211  %rdx.add = call i16 @llvm.vector.reduce.add.v2i16(<2 x i16> %p0)212  ret i16 %rdx.add213}214 215define noundef i16 @test_length_short3(<3 x i16> noundef %p0) {216; CHECK-LABEL: define noundef i16 @test_length_short3(217; CHECK-SAME: <3 x i16> noundef [[P0:%.*]]) {218; CHECK-NEXT:  [[ENTRY:.*:]]219; CHECK-NEXT:    [[TMP0:%.*]] = extractelement <3 x i16> [[P0]], i64 0220; CHECK-NEXT:    [[TMP1:%.*]] = extractelement <3 x i16> [[P0]], i64 1221; CHECK-NEXT:    [[TMP2:%.*]] = add i16 [[TMP0]], [[TMP1]]222; CHECK-NEXT:    [[TMP3:%.*]] = extractelement <3 x i16> [[P0]], i64 2223; CHECK-NEXT:    [[TMP4:%.*]] = add i16 [[TMP2]], [[TMP3]]224; CHECK-NEXT:    ret i16 [[TMP4]]225;226entry:227  %rdx.fadd = call i16 @llvm.vector.reduce.add.v3i16(<3 x i16> %p0)228  ret i16 %rdx.fadd229}230 231define noundef i16 @test_length_short4(<4 x i16> noundef %p0) {232; CHECK-LABEL: define noundef i16 @test_length_short4(233; CHECK-SAME: <4 x i16> noundef [[P0:%.*]]) {234; CHECK-NEXT:  [[ENTRY:.*:]]235; CHECK-NEXT:    [[TMP0:%.*]] = extractelement <4 x i16> [[P0]], i64 0236; CHECK-NEXT:    [[TMP1:%.*]] = extractelement <4 x i16> [[P0]], i64 1237; CHECK-NEXT:    [[TMP2:%.*]] = add i16 [[TMP0]], [[TMP1]]238; CHECK-NEXT:    [[TMP3:%.*]] = extractelement <4 x i16> [[P0]], i64 2239; CHECK-NEXT:    [[TMP4:%.*]] = add i16 [[TMP2]], [[TMP3]]240; CHECK-NEXT:    [[TMP5:%.*]] = extractelement <4 x i16> [[P0]], i64 3241; CHECK-NEXT:    [[TMP6:%.*]] = add i16 [[TMP4]], [[TMP5]]242; CHECK-NEXT:    ret i16 [[TMP6]]243;244entry:245  %rdx.fadd = call i16 @llvm.vector.reduce.add.v4i16(<4 x i16> %p0)246  ret i16 %rdx.fadd247}248 249define noundef i32 @test_length_int2(<2 x i32> noundef %p0) {250; CHECK-LABEL: define noundef i32 @test_length_int2(251; CHECK-SAME: <2 x i32> noundef [[P0:%.*]]) {252; CHECK-NEXT:  [[ENTRY:.*:]]253; CHECK-NEXT:    [[TMP0:%.*]] = extractelement <2 x i32> [[P0]], i64 0254; CHECK-NEXT:    [[TMP1:%.*]] = extractelement <2 x i32> [[P0]], i64 1255; CHECK-NEXT:    [[TMP2:%.*]] = add i32 [[TMP0]], [[TMP1]]256; CHECK-NEXT:    ret i32 [[TMP2]]257;258entry:259  %rdx.add = call i32 @llvm.vector.reduce.add.v2i32(<2 x i32> %p0)260  ret i32 %rdx.add261}262 263define noundef i32 @test_length_int3(<3 x i32> noundef %p0) {264; CHECK-LABEL: define noundef i32 @test_length_int3(265; CHECK-SAME: <3 x i32> noundef [[P0:%.*]]) {266; CHECK-NEXT:  [[ENTRY:.*:]]267; CHECK-NEXT:    [[TMP0:%.*]] = extractelement <3 x i32> [[P0]], i64 0268; CHECK-NEXT:    [[TMP1:%.*]] = extractelement <3 x i32> [[P0]], i64 1269; CHECK-NEXT:    [[TMP2:%.*]] = add i32 [[TMP0]], [[TMP1]]270; CHECK-NEXT:    [[TMP3:%.*]] = extractelement <3 x i32> [[P0]], i64 2271; CHECK-NEXT:    [[TMP4:%.*]] = add i32 [[TMP2]], [[TMP3]]272; CHECK-NEXT:    ret i32 [[TMP4]]273;274entry:275  %rdx.fadd = call i32 @llvm.vector.reduce.add.v3i32(<3 x i32> %p0)276  ret i32 %rdx.fadd277}278 279define noundef i32 @test_length_int4(<4 x i32> noundef %p0) {280; CHECK-LABEL: define noundef i32 @test_length_int4(281; CHECK-SAME: <4 x i32> noundef [[P0:%.*]]) {282; CHECK-NEXT:  [[ENTRY:.*:]]283; CHECK-NEXT:    [[TMP0:%.*]] = extractelement <4 x i32> [[P0]], i64 0284; CHECK-NEXT:    [[TMP1:%.*]] = extractelement <4 x i32> [[P0]], i64 1285; CHECK-NEXT:    [[TMP2:%.*]] = add i32 [[TMP0]], [[TMP1]]286; CHECK-NEXT:    [[TMP3:%.*]] = extractelement <4 x i32> [[P0]], i64 2287; CHECK-NEXT:    [[TMP4:%.*]] = add i32 [[TMP2]], [[TMP3]]288; CHECK-NEXT:    [[TMP5:%.*]] = extractelement <4 x i32> [[P0]], i64 3289; CHECK-NEXT:    [[TMP6:%.*]] = add i32 [[TMP4]], [[TMP5]]290; CHECK-NEXT:    ret i32 [[TMP6]]291;292entry:293  %rdx.fadd = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %p0)294  ret i32 %rdx.fadd295}296 297define noundef i64 @test_length_int64_2(<2 x i64> noundef %p0) {298; CHECK-LABEL: define noundef i64 @test_length_int64_2(299; CHECK-SAME: <2 x i64> noundef [[P0:%.*]]) {300; CHECK-NEXT:  [[ENTRY:.*:]]301; CHECK-NEXT:    [[TMP0:%.*]] = extractelement <2 x i64> [[P0]], i64 0302; CHECK-NEXT:    [[TMP1:%.*]] = extractelement <2 x i64> [[P0]], i64 1303; CHECK-NEXT:    [[TMP2:%.*]] = add i64 [[TMP0]], [[TMP1]]304; CHECK-NEXT:    ret i64 [[TMP2]]305;306entry:307  %rdx.add = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %p0)308  ret i64 %rdx.add309}310 311define noundef i64 @test_length_int64_3(<3 x i64> noundef %p0) {312; CHECK-LABEL: define noundef i64 @test_length_int64_3(313; CHECK-SAME: <3 x i64> noundef [[P0:%.*]]) {314; CHECK-NEXT:  [[ENTRY:.*:]]315; CHECK-NEXT:    [[TMP0:%.*]] = extractelement <3 x i64> [[P0]], i64 0316; CHECK-NEXT:    [[TMP1:%.*]] = extractelement <3 x i64> [[P0]], i64 1317; CHECK-NEXT:    [[TMP2:%.*]] = add i64 [[TMP0]], [[TMP1]]318; CHECK-NEXT:    [[TMP3:%.*]] = extractelement <3 x i64> [[P0]], i64 2319; CHECK-NEXT:    [[TMP4:%.*]] = add i64 [[TMP2]], [[TMP3]]320; CHECK-NEXT:    ret i64 [[TMP4]]321;322entry:323  %rdx.fadd = call i64 @llvm.vector.reduce.add.v3i64(<3 x i64> %p0)324  ret i64 %rdx.fadd325}326 327define noundef i64 @test_length_int64_4(<4 x i64> noundef %p0) {328; CHECK-LABEL: define noundef i64 @test_length_int64_4(329; CHECK-SAME: <4 x i64> noundef [[P0:%.*]]) {330; CHECK-NEXT:  [[ENTRY:.*:]]331; CHECK-NEXT:    [[TMP0:%.*]] = extractelement <4 x i64> [[P0]], i64 0332; CHECK-NEXT:    [[TMP1:%.*]] = extractelement <4 x i64> [[P0]], i64 1333; CHECK-NEXT:    [[TMP2:%.*]] = add i64 [[TMP0]], [[TMP1]]334; CHECK-NEXT:    [[TMP3:%.*]] = extractelement <4 x i64> [[P0]], i64 2335; CHECK-NEXT:    [[TMP4:%.*]] = add i64 [[TMP2]], [[TMP3]]336; CHECK-NEXT:    [[TMP5:%.*]] = extractelement <4 x i64> [[P0]], i64 3337; CHECK-NEXT:    [[TMP6:%.*]] = add i64 [[TMP4]], [[TMP5]]338; CHECK-NEXT:    ret i64 [[TMP6]]339;340entry:341  %rdx.fadd = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %p0)342  ret i64 %rdx.fadd343}344