1 ; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s 2 ; RUN: llc -march=amdgcn -mcpu=SI < %s | FileCheck -check-prefix=SI -check-prefix=SI-SAFE -check-prefix=FUNC %s 3 ; RUN: llc -march=amdgcn -mcpu=SI -enable-unsafe-fp-math < %s | FileCheck -check-prefix=SI -check-prefix=SI-UNSAFE -check-prefix=FUNC %s 4 ; RUN: llc -march=amdgcn -mcpu=tonga < %s | FileCheck -check-prefix=SI -check-prefix=SI-SAFE -check-prefix=FUNC %s 5 ; RUN: llc -march=amdgcn -mcpu=tonga -enable-unsafe-fp-math < %s | FileCheck -check-prefix=SI -check-prefix=SI-UNSAFE -check-prefix=FUNC %s 6 7 ; FUNC-LABEL: sin_f32 8 ; EG: MULADD_IEEE * 9 ; EG: FRACT * 10 ; EG: ADD * 11 ; EG: SIN * T{{[0-9]+\.[XYZW], PV\.[XYZW]}} 12 ; EG-NOT: SIN 13 ; SI: v_mul_f32 14 ; SI: v_fract_f32 15 ; SI: v_sin_f32 16 ; SI-NOT: v_sin_f32 17 18 define void @sin_f32(float addrspace(1)* %out, float %x) #1 { 19 %sin = call float @llvm.sin.f32(float %x) 20 store float %sin, float addrspace(1)* %out 21 ret void 22 } 23 24 ; FUNC-LABEL: {{^}}sin_3x_f32: 25 ; SI-UNSAFE-NOT: v_add_f32 26 ; SI-UNSAFE: 0x3ef47644 27 ; SI-UNSAFE: v_mul_f32 28 ; SI-SAFE: v_mul_f32 29 ; SI-SAFE: v_mul_f32 30 ; SI: v_fract_f32 31 ; SI: v_sin_f32 32 ; SI-NOT: v_sin_f32 33 define void @sin_3x_f32(float addrspace(1)* %out, float %x) #1 { 34 %y = fmul float 3.0, %x 35 %sin = call float @llvm.sin.f32(float %y) 36 store float %sin, float addrspace(1)* %out 37 ret void 38 } 39 40 ; FUNC-LABEL: {{^}}sin_2x_f32: 41 ; SI-UNSAFE-NOT: v_add_f32 42 ; SI-UNSAFE: 0x3ea2f983 43 ; SI-UNSAFE: v_mul_f32 44 ; SI-SAFE: v_add_f32 45 ; SI-SAFE: v_mul_f32 46 ; SI: v_fract_f32 47 ; SI: v_sin_f32 48 ; SI-NOT: v_sin_f32 49 define void @sin_2x_f32(float addrspace(1)* %out, float %x) #1 { 50 %y = fmul float 2.0, %x 51 %sin = call float @llvm.sin.f32(float %y) 52 store float %sin, float addrspace(1)* %out 53 ret void 54 } 55 56 ; FUNC-LABEL: {{^}}test_2sin_f32: 57 ; SI-UNSAFE: 0x3ea2f983 58 ; SI-UNSAFE: v_mul_f32 59 ; SI-SAFE: v_add_f32 60 ; SI-SAFE: v_mul_f32 61 ; SI: v_fract_f32 62 ; SI: v_sin_f32 63 ; SI-NOT: v_sin_f32 64 define void @test_2sin_f32(float addrspace(1)* %out, float %x) #1 { 65 %y = fmul float 2.0, %x 66 %sin = call float @llvm.sin.f32(float %y) 67 store float %sin, float addrspace(1)* %out 68 ret void 69 } 70 71 ; FUNC-LABEL: {{^}}sin_v4f32: 72 ; EG: SIN * T{{[0-9]+\.[XYZW], PV\.[XYZW]}} 73 ; EG: SIN * T{{[0-9]+\.[XYZW], PV\.[XYZW]}} 74 ; EG: SIN * T{{[0-9]+\.[XYZW], PV\.[XYZW]}} 75 ; EG: SIN * T{{[0-9]+\.[XYZW], PV\.[XYZW]}} 76 ; EG-NOT: SIN 77 ; SI: v_sin_f32 78 ; SI: v_sin_f32 79 ; SI: v_sin_f32 80 ; SI: v_sin_f32 81 ; SI-NOT: v_sin_f32 82 83 define void @sin_v4f32(<4 x float> addrspace(1)* %out, <4 x float> %vx) #1 { 84 %sin = call <4 x float> @llvm.sin.v4f32( <4 x float> %vx) 85 store <4 x float> %sin, <4 x float> addrspace(1)* %out 86 ret void 87 } 88 89 declare float @llvm.sin.f32(float) readnone 90 declare <4 x float> @llvm.sin.v4f32(<4 x float>) readnone 91 92 attributes #0 = { "ShaderType"="0" } 93