78 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 42; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -O1 -amdgpu-prelink %s | FileCheck %s3 4; Make sure that sin+cos -> sincos simplification happens after5; initial IR simplifications, otherwise we can't identify the common6; argument value.7 8@.str = private unnamed_addr addrspace(4) constant [21 x i8] c"x: %f, y: %f, z: %f\0A\00", align 19 10; Should have call to sincos declarations, not calls to the asm pseudo-libcalls11define protected amdgpu_kernel void @swdev456865(ptr addrspace(1) %out0, ptr addrspace(1) %out1, ptr addrspace(1) %out2, float noundef %x) #0 {12; CHECK-LABEL: define protected amdgpu_kernel void @swdev456865(13; CHECK-SAME: ptr addrspace(1) writeonly captures(none) initializes((0, 8)) [[OUT0:%.*]], ptr addrspace(1) writeonly captures(none) initializes((0, 8)) [[OUT1:%.*]], ptr addrspace(1) writeonly captures(none) initializes((0, 8)) [[OUT2:%.*]], float noundef [[X:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {14; CHECK-NEXT: entry:15; CHECK-NEXT: [[__SINCOS_:%.*]] = alloca float, align 4, addrspace(5)16; CHECK-NEXT: [[I_I:%.*]] = call float @_Z6sincosfPU3AS5f(float [[X]], ptr addrspace(5) [[__SINCOS_]]) #[[ATTR2:[0-9]+]]17; CHECK-NEXT: [[I_I2:%.*]] = load float, ptr addrspace(5) [[__SINCOS_]], align 418; CHECK-NEXT: [[ADD:%.*]] = fadd float [[I_I]], [[I_I2]]19; CHECK-NEXT: [[CONV:%.*]] = fpext float [[X]] to double20; CHECK-NEXT: [[CONV5:%.*]] = fpext float [[ADD]] to double21; CHECK-NEXT: store double [[CONV]], ptr addrspace(1) [[OUT0]], align 822; CHECK-NEXT: store double [[CONV5]], ptr addrspace(1) [[OUT1]], align 823; CHECK-NEXT: store double [[CONV5]], ptr addrspace(1) [[OUT2]], align 824; CHECK-NEXT: ret void25;26entry:27 %x.addr = alloca float, align 4, addrspace(5)28 %y = alloca float, align 4, addrspace(5)29 %z = alloca float, align 4, addrspace(5)30 store float %x, ptr addrspace(5) %x.addr, align 431 call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) %y)32 %i = load float, ptr addrspace(5) %x.addr, align 433 %call = call float @_Z3sinf(float noundef %i) #334 %i1 = load float, ptr addrspace(5) %x.addr, align 435 %call1 = call float @_Z3cosf(float noundef %i1) #336 %add = fadd float %call, %call137 store float %add, ptr addrspace(5) %y, align 438 call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) %z)39 %i2 = load float, ptr addrspace(5) %x.addr, align 440 %call2 = call float @_Z3cosf(float noundef %i2) #341 %i3 = load float, ptr addrspace(5) %x.addr, align 442 %call3 = call float @_Z3sinf(float noundef %i3) #343 %add4 = fadd float %call2, %call344 store float %add4, ptr addrspace(5) %z, align 445 %i4 = load float, ptr addrspace(5) %x.addr, align 446 %conv = fpext float %i4 to double47 %i5 = load float, ptr addrspace(5) %y, align 448 %conv5 = fpext float %i5 to double49 %i6 = load float, ptr addrspace(5) %z, align 450 %conv6 = fpext float %i6 to double51 store double %conv, ptr addrspace(1) %out0, align 852 store double %conv5, ptr addrspace(1) %out1, align 853 store double %conv6, ptr addrspace(1) %out2, align 854 call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) %z)55 call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) %y)56 ret void57}58 59declare void @llvm.lifetime.start.p5(i64 immarg, ptr addrspace(5) nocapture) #160declare void @llvm.lifetime.end.p5(i64 immarg, ptr addrspace(5) nocapture) #161 62define internal float @_Z3cosf(float noundef %arg) #2 {63bb:64 %i = tail call float asm "pseudo-libcall-cos %0, %1", "=v,v"(float noundef %arg) #265 ret float %i66}67 68define internal float @_Z3sinf(float noundef %arg) #2 {69bb:70 %i = tail call float asm "pseudo-libcall-sin %0, %1", "=v,v"(float noundef %arg) #271 ret float %i72}73 74attributes #0 = { norecurse nounwind }75attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }76attributes #2 = { mustprogress nofree norecurse nounwind willreturn memory(none) }77attributes #3 = { nounwind willreturn memory(none) }78