brintos

brintos / llvm-project-archived public Read only

0
0
Text · 11.8 KiB · 09308df Raw
326 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 22; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -passes=amdgpu-simplifylib %s | FileCheck %s3 4declare float @_Z4fabsf(float)5declare <2 x float> @_Z4fabsDv2_f(<2 x float>)6declare <3 x float> @_Z4fabsDv3_f(<3 x float>)7declare <4 x float> @_Z4fabsDv4_f(<4 x float>)8declare <8 x float> @_Z4fabsDv8_f(<8 x float>)9declare <16 x float> @_Z4fabsDv16_f(<16 x float>)10 11declare double @_Z4fabsd(double)12declare <2 x double> @_Z4fabsDv2_d(<2 x double>)13declare <3 x double> @_Z4fabsDv3_d(<3 x double>)14declare <4 x double> @_Z4fabsDv4_d(<4 x double>)15declare <8 x double> @_Z4fabsDv8_d(<8 x double>)16declare <16 x double> @_Z4fabsDv16_d(<16 x double>)17 18declare half @_Z4fabsDh(half)19declare <2 x half> @_Z4fabsDv2_Dh(<2 x half>)20declare <3 x half> @_Z4fabsDv3_Dh(<3 x half>)21declare <4 x half> @_Z4fabsDv4_Dh(<4 x half>)22declare <8 x half> @_Z4fabsDv8_Dh(<8 x half>)23declare <16 x half> @_Z4fabsDv16_Dh(<16 x half>)24 25define float @test_fabs_f32(float %arg) {26; CHECK-LABEL: define float @test_fabs_f3227; CHECK-SAME: (float [[ARG:%.*]]) {28; CHECK-NEXT:    [[FABS:%.*]] = tail call float @llvm.fabs.f32(float [[ARG]])29; CHECK-NEXT:    ret float [[FABS]]30;31  %fabs = tail call float @_Z4fabsf(float %arg)32  ret float %fabs33}34 35define <2 x float> @test_fabs_v2f32(<2 x float> %arg) {36; CHECK-LABEL: define <2 x float> @test_fabs_v2f3237; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {38; CHECK-NEXT:    [[FABS:%.*]] = tail call <2 x float> @llvm.fabs.v2f32(<2 x float> [[ARG]])39; CHECK-NEXT:    ret <2 x float> [[FABS]]40;41  %fabs = tail call <2 x float> @_Z4fabsDv2_f(<2 x float> %arg)42  ret <2 x float> %fabs43}44 45define <3 x float> @test_fabs_v3f32(<3 x float> %arg) {46; CHECK-LABEL: define <3 x float> @test_fabs_v3f3247; CHECK-SAME: (<3 x float> [[ARG:%.*]]) {48; CHECK-NEXT:    [[FABS:%.*]] = tail call <3 x float> @llvm.fabs.v3f32(<3 x float> [[ARG]])49; CHECK-NEXT:    ret <3 x float> [[FABS]]50;51  %fabs = tail call <3 x float> @_Z4fabsDv3_f(<3 x float> %arg)52  ret <3 x float> %fabs53}54 55define <4 x float> @test_fabs_v4f32(<4 x float> %arg) {56; CHECK-LABEL: define <4 x float> @test_fabs_v4f3257; CHECK-SAME: (<4 x float> [[ARG:%.*]]) {58; CHECK-NEXT:    [[FABS:%.*]] = tail call <4 x float> @llvm.fabs.v4f32(<4 x float> [[ARG]])59; CHECK-NEXT:    ret <4 x float> [[FABS]]60;61  %fabs = tail call <4 x float> @_Z4fabsDv4_f(<4 x float> %arg)62  ret <4 x float> %fabs63}64 65define <8 x float> @test_fabs_v8f32(<8 x float> %arg) {66; CHECK-LABEL: define <8 x float> @test_fabs_v8f3267; CHECK-SAME: (<8 x float> [[ARG:%.*]]) {68; CHECK-NEXT:    [[FABS:%.*]] = tail call <8 x float> @llvm.fabs.v8f32(<8 x float> [[ARG]])69; CHECK-NEXT:    ret <8 x float> [[FABS]]70;71  %fabs = tail call <8 x float> @_Z4fabsDv8_f(<8 x float> %arg)72  ret <8 x float> %fabs73}74 75define <16 x float> @test_fabs_v16f32(<16 x float> %arg) {76; CHECK-LABEL: define <16 x float> @test_fabs_v16f3277; CHECK-SAME: (<16 x float> [[ARG:%.*]]) {78; CHECK-NEXT:    [[FABS:%.*]] = tail call <16 x float> @llvm.fabs.v16f32(<16 x float> [[ARG]])79; CHECK-NEXT:    ret <16 x float> [[FABS]]80;81  %fabs = tail call <16 x float> @_Z4fabsDv16_f(<16 x float> %arg)82  ret <16 x float> %fabs83}84 85define double @test_fabs_f64(double %arg) {86; CHECK-LABEL: define double @test_fabs_f6487; CHECK-SAME: (double [[ARG:%.*]]) {88; CHECK-NEXT:    [[FABS:%.*]] = tail call double @llvm.fabs.f64(double [[ARG]])89; CHECK-NEXT:    ret double [[FABS]]90;91  %fabs = tail call double @_Z4fabsd(double %arg)92  ret double %fabs93}94 95define <2 x double> @test_fabs_v2f64(<2 x double> %arg) {96; CHECK-LABEL: define <2 x double> @test_fabs_v2f6497; CHECK-SAME: (<2 x double> [[ARG:%.*]]) {98; CHECK-NEXT:    [[FABS:%.*]] = tail call <2 x double> @llvm.fabs.v2f64(<2 x double> [[ARG]])99; CHECK-NEXT:    ret <2 x double> [[FABS]]100;101  %fabs = tail call <2 x double> @_Z4fabsDv2_d(<2 x double> %arg)102  ret <2 x double> %fabs103}104 105define <3 x double> @test_fabs_v3f64(<3 x double> %arg) {106; CHECK-LABEL: define <3 x double> @test_fabs_v3f64107; CHECK-SAME: (<3 x double> [[ARG:%.*]]) {108; CHECK-NEXT:    [[FABS:%.*]] = tail call <3 x double> @llvm.fabs.v3f64(<3 x double> [[ARG]])109; CHECK-NEXT:    ret <3 x double> [[FABS]]110;111  %fabs = tail call <3 x double> @_Z4fabsDv3_d(<3 x double> %arg)112  ret <3 x double> %fabs113}114 115define <4 x double> @test_fabs_v4f64(<4 x double> %arg) {116; CHECK-LABEL: define <4 x double> @test_fabs_v4f64117; CHECK-SAME: (<4 x double> [[ARG:%.*]]) {118; CHECK-NEXT:    [[FABS:%.*]] = tail call <4 x double> @llvm.fabs.v4f64(<4 x double> [[ARG]])119; CHECK-NEXT:    ret <4 x double> [[FABS]]120;121  %fabs = tail call <4 x double> @_Z4fabsDv4_d(<4 x double> %arg)122  ret <4 x double> %fabs123}124 125define <8 x double> @test_fabs_v8f64(<8 x double> %arg) {126; CHECK-LABEL: define <8 x double> @test_fabs_v8f64127; CHECK-SAME: (<8 x double> [[ARG:%.*]]) {128; CHECK-NEXT:    [[FABS:%.*]] = tail call <8 x double> @llvm.fabs.v8f64(<8 x double> [[ARG]])129; CHECK-NEXT:    ret <8 x double> [[FABS]]130;131  %fabs = tail call <8 x double> @_Z4fabsDv8_d(<8 x double> %arg)132  ret <8 x double> %fabs133}134 135define <16 x double> @test_fabs_v16f64(<16 x double> %arg) {136; CHECK-LABEL: define <16 x double> @test_fabs_v16f64137; CHECK-SAME: (<16 x double> [[ARG:%.*]]) {138; CHECK-NEXT:    [[FABS:%.*]] = tail call <16 x double> @llvm.fabs.v16f64(<16 x double> [[ARG]])139; CHECK-NEXT:    ret <16 x double> [[FABS]]140;141  %fabs = tail call <16 x double> @_Z4fabsDv16_d(<16 x double> %arg)142  ret <16 x double> %fabs143}144 145define half @test_fabs_f16(half %arg) {146; CHECK-LABEL: define half @test_fabs_f16147; CHECK-SAME: (half [[ARG:%.*]]) {148; CHECK-NEXT:    [[FABS:%.*]] = tail call half @llvm.fabs.f16(half [[ARG]])149; CHECK-NEXT:    ret half [[FABS]]150;151  %fabs = tail call half @_Z4fabsDh(half %arg)152  ret half %fabs153}154 155define <2 x half> @test_fabs_v2f16(<2 x half> %arg) {156; CHECK-LABEL: define <2 x half> @test_fabs_v2f16157; CHECK-SAME: (<2 x half> [[ARG:%.*]]) {158; CHECK-NEXT:    [[FABS:%.*]] = tail call <2 x half> @llvm.fabs.v2f16(<2 x half> [[ARG]])159; CHECK-NEXT:    ret <2 x half> [[FABS]]160;161  %fabs = tail call <2 x half> @_Z4fabsDv2_Dh(<2 x half> %arg)162  ret <2 x half> %fabs163}164 165define <3 x half> @test_fabs_v3f16(<3 x half> %arg) {166; CHECK-LABEL: define <3 x half> @test_fabs_v3f16167; CHECK-SAME: (<3 x half> [[ARG:%.*]]) {168; CHECK-NEXT:    [[FABS:%.*]] = tail call <3 x half> @llvm.fabs.v3f16(<3 x half> [[ARG]])169; CHECK-NEXT:    ret <3 x half> [[FABS]]170;171  %fabs = tail call <3 x half> @_Z4fabsDv3_Dh(<3 x half> %arg)172  ret <3 x half> %fabs173}174 175define <4 x half> @test_fabs_v4f16(<4 x half> %arg) {176; CHECK-LABEL: define <4 x half> @test_fabs_v4f16177; CHECK-SAME: (<4 x half> [[ARG:%.*]]) {178; CHECK-NEXT:    [[FABS:%.*]] = tail call <4 x half> @llvm.fabs.v4f16(<4 x half> [[ARG]])179; CHECK-NEXT:    ret <4 x half> [[FABS]]180;181  %fabs = tail call <4 x half> @_Z4fabsDv4_Dh(<4 x half> %arg)182  ret <4 x half> %fabs183}184 185define <8 x half> @test_fabs_v8f16(<8 x half> %arg) {186; CHECK-LABEL: define <8 x half> @test_fabs_v8f16187; CHECK-SAME: (<8 x half> [[ARG:%.*]]) {188; CHECK-NEXT:    [[FABS:%.*]] = tail call <8 x half> @llvm.fabs.v8f16(<8 x half> [[ARG]])189; CHECK-NEXT:    ret <8 x half> [[FABS]]190;191  %fabs = tail call <8 x half> @_Z4fabsDv8_Dh(<8 x half> %arg)192  ret <8 x half> %fabs193}194 195define <16 x half> @test_fabs_v16f16(<16 x half> %arg) {196; CHECK-LABEL: define <16 x half> @test_fabs_v16f16197; CHECK-SAME: (<16 x half> [[ARG:%.*]]) {198; CHECK-NEXT:    [[FABS:%.*]] = tail call <16 x half> @llvm.fabs.v16f16(<16 x half> [[ARG]])199; CHECK-NEXT:    ret <16 x half> [[FABS]]200;201  %fabs = tail call <16 x half> @_Z4fabsDv16_Dh(<16 x half> %arg)202  ret <16 x half> %fabs203}204 205define float @test_fabs_f32_nobuiltin_callsite(float %arg) {206; CHECK-LABEL: define float @test_fabs_f32_nobuiltin_callsite207; CHECK-SAME: (float [[ARG:%.*]]) {208; CHECK-NEXT:    [[FABS:%.*]] = tail call float @_Z4fabsf(float [[ARG]]) #[[ATTR4:[0-9]+]]209; CHECK-NEXT:    ret float [[FABS]]210;211  %fabs = tail call float @_Z4fabsf(float %arg) #0212  ret float %fabs213}214 215define <2 x float> @test_fabs_v2f32_nobuiltin_callsite(<2 x float> %arg) {216; CHECK-LABEL: define <2 x float> @test_fabs_v2f32_nobuiltin_callsite217; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {218; CHECK-NEXT:    [[FABS:%.*]] = tail call <2 x float> @_Z4fabsDv2_f(<2 x float> [[ARG]]) #[[ATTR4]]219; CHECK-NEXT:    ret <2 x float> [[FABS]]220;221  %fabs = tail call <2 x float> @_Z4fabsDv2_f(<2 x float> %arg) #0222  ret <2 x float> %fabs223}224 225; "no-builtins" should be ignored226define float @test_fabs_f32_nobuiltins(float %arg) #1 {227; CHECK-LABEL: define float @test_fabs_f32_nobuiltins228; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR0:[0-9]+]] {229; CHECK-NEXT:    [[FABS:%.*]] = tail call float @_Z4fabsf(float [[ARG]]) #[[ATTR4]]230; CHECK-NEXT:    ret float [[FABS]]231;232  %fabs = tail call float @_Z4fabsf(float %arg) #0233  ret float %fabs234}235 236define <2 x float> @test_fabs_v2f32_nobuiltins(<2 x float> %arg) #1 {237; CHECK-LABEL: define <2 x float> @test_fabs_v2f32_nobuiltins238; CHECK-SAME: (<2 x float> [[ARG:%.*]]) #[[ATTR0]] {239; CHECK-NEXT:    [[FABS:%.*]] = tail call <2 x float> @_Z4fabsDv2_f(<2 x float> [[ARG]]) #[[ATTR4]]240; CHECK-NEXT:    ret <2 x float> [[FABS]]241;242  %fabs = tail call <2 x float> @_Z4fabsDv2_f(<2 x float> %arg) #0243  ret <2 x float> %fabs244}245 246define float @test_fabs_f32_preserve_flags(float %arg) {247; CHECK-LABEL: define float @test_fabs_f32_preserve_flags248; CHECK-SAME: (float [[ARG:%.*]]) {249; CHECK-NEXT:    [[FABS:%.*]] = tail call nnan ninf float @llvm.fabs.f32(float [[ARG]])250; CHECK-NEXT:    ret float [[FABS]]251;252  %fabs = tail call nnan ninf float @_Z4fabsf(float %arg)253  ret float %fabs254}255 256define <2 x float> @test_fabs_v2f32_preserve_flags(<2 x float> %arg) {257; CHECK-LABEL: define <2 x float> @test_fabs_v2f32_preserve_flags258; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {259; CHECK-NEXT:    [[FABS:%.*]] = tail call nnan nsz contract <2 x float> @llvm.fabs.v2f32(<2 x float> [[ARG]])260; CHECK-NEXT:    ret <2 x float> [[FABS]]261;262  %fabs = tail call contract nsz nnan <2 x float> @_Z4fabsDv2_f(<2 x float> %arg)263  ret <2 x float> %fabs264}265 266define float @test_fabs_f32_preserve_flags_md(float %arg) {267; CHECK-LABEL: define float @test_fabs_f32_preserve_flags_md268; CHECK-SAME: (float [[ARG:%.*]]) {269; CHECK-NEXT:    [[FABS:%.*]] = tail call nnan ninf float @llvm.fabs.f32(float [[ARG]]), !foo !0270; CHECK-NEXT:    ret float [[FABS]]271;272  %fabs = tail call nnan ninf float @_Z4fabsf(float %arg), !foo !0273  ret float %fabs274}275 276define <2 x float> @test_fabs_v2f32_preserve_flags_md(<2 x float> %arg) {277; CHECK-LABEL: define <2 x float> @test_fabs_v2f32_preserve_flags_md278; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {279; CHECK-NEXT:    [[FABS:%.*]] = tail call nnan nsz contract <2 x float> @llvm.fabs.v2f32(<2 x float> [[ARG]]), !foo !0280; CHECK-NEXT:    ret <2 x float> [[FABS]]281;282  %fabs = tail call contract nsz nnan <2 x float> @_Z4fabsDv2_f(<2 x float> %arg), !foo !0283  ret <2 x float> %fabs284}285 286; Test the libm name, not a recognized opencl builtin.287declare float @fabsf(float) #2288declare double @fabs(double) #2289 290define float @test_libm_fabs_f32(float %arg) {291; CHECK-LABEL: define float @test_libm_fabs_f32292; CHECK-SAME: (float [[ARG:%.*]]) {293; CHECK-NEXT:    [[FABS:%.*]] = tail call float @fabsf(float [[ARG]])294; CHECK-NEXT:    ret float [[FABS]]295;296  %fabs = tail call float @fabsf(float %arg)297  ret float %fabs298}299 300define double @test_libm_fabs_f64(double %arg) {301; CHECK-LABEL: define double @test_libm_fabs_f64302; CHECK-SAME: (double [[ARG:%.*]]) {303; CHECK-NEXT:    [[FABS:%.*]] = tail call double @fabs(double [[ARG]])304; CHECK-NEXT:    ret double [[FABS]]305;306  %fabs = tail call double @fabs(double %arg)307  ret double %fabs308}309 310define float @test_fabs_f32_strictfp(float %arg) #3 {311; CHECK-LABEL: define float @test_fabs_f32_strictfp312; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR2:[0-9]+]] {313; CHECK-NEXT:    [[FABS:%.*]] = tail call nnan float @llvm.fabs.f32(float [[ARG]]) #[[ATTR2]]314; CHECK-NEXT:    ret float [[FABS]]315;316  %fabs = tail call nnan float @_Z4fabsf(float %arg) #3317  ret float %fabs318}319 320attributes #0 = { nobuiltin }321attributes #1 = { "no-builtins" }322attributes #2 = { nounwind memory(none) }323attributes #3 = { strictfp }324 325!0 = !{i32 1234}326