1; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s 2; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s 3 4; FUNC-LABEL: sin_f32 5; EG: MULADD_IEEE * 6; EG: FRACT * 7; EG: ADD * 8; EG: SIN * T{{[0-9]+\.[XYZW], PV\.[XYZW]}} 9; EG-NOT: SIN 10 11; SI: v_mul_f32 12; SI: v_fract_f32 13; SI: v_sin_f32 14; SI-NOT: v_sin_f32 15define void @sin_f32(float addrspace(1)* %out, float %x) #1 { 16 %sin = call float @llvm.sin.f32(float %x) 17 store float %sin, float addrspace(1)* %out 18 ret void 19} 20 21; FUNC-LABEL: {{^}}safe_sin_3x_f32: 22; SI: v_mul_f32 23; SI: v_mul_f32 24; SI: v_fract_f32 25; SI: v_sin_f32 26; SI-NOT: v_sin_f32 27define void @safe_sin_3x_f32(float addrspace(1)* %out, float %x) #1 { 28 %y = fmul float 3.0, %x 29 %sin = call float @llvm.sin.f32(float %y) 30 store float %sin, float addrspace(1)* %out 31 ret void 32} 33 34; FUNC-LABEL: {{^}}unsafe_sin_3x_f32: 35; SI-NOT: v_add_f32 36; SI: 0x3ef47644 37; SI: v_mul_f32 38; SI: v_fract_f32 39; SI: v_sin_f32 40; SI-NOT: v_sin_f32 41define void @unsafe_sin_3x_f32(float addrspace(1)* %out, float %x) #2 { 42 %y = fmul float 3.0, %x 43 %sin = call float @llvm.sin.f32(float %y) 44 store float %sin, float addrspace(1)* %out 45 ret void 46} 47 48; FUNC-LABEL: {{^}}safe_sin_2x_f32: 49; SI: v_add_f32 50; SI: v_mul_f32 51; SI: v_fract_f32 52; SI: v_sin_f32 53; SI-NOT: v_sin_f32 54define void @safe_sin_2x_f32(float addrspace(1)* %out, float %x) #1 { 55 %y = fmul float 2.0, %x 56 %sin = call float @llvm.sin.f32(float %y) 57 store float %sin, float addrspace(1)* %out 58 ret void 59} 60 61; FUNC-LABEL: {{^}}unsafe_sin_2x_f32: 62; SI-NOT: v_add_f32 63; SI: 0x3ea2f983 64; SI: v_mul_f32 65; SI: v_fract_f32 66; SI: v_sin_f32 67; SI-NOT: v_sin_f32 68define void @unsafe_sin_2x_f32(float addrspace(1)* %out, float %x) #2 { 69 %y = fmul float 2.0, %x 70 %sin = call float @llvm.sin.f32(float %y) 71 store float %sin, float addrspace(1)* %out 72 ret void 73} 74 75; FUNC-LABEL: {{^}}test_safe_2sin_f32: 76; SI: v_add_f32 77; SI: v_mul_f32 78; SI: v_fract_f32 79; SI: v_sin_f32 80; SI-NOT: v_sin_f32 81define void @test_safe_2sin_f32(float addrspace(1)* %out, float %x) #1 { 82 %y = fmul float 2.0, %x 83 %sin = call float @llvm.sin.f32(float %y) 84 store float %sin, float addrspace(1)* %out 85 ret void 86} 87 88; FUNC-LABEL: {{^}}test_unsafe_2sin_f32: 89; SI: 0x3ea2f983 90; SI: v_mul_f32 91; SI: v_fract_f32 92; SI: v_sin_f32 93; SI-NOT: v_sin_f32 94define void @test_unsafe_2sin_f32(float addrspace(1)* %out, float %x) #2 { 95 %y = fmul float 2.0, %x 96 %sin = call float @llvm.sin.f32(float %y) 97 store float %sin, float addrspace(1)* %out 98 ret void 99} 100 101; FUNC-LABEL: {{^}}sin_v4f32: 102; EG: SIN * T{{[0-9]+\.[XYZW], PV\.[XYZW]}} 103; EG: SIN * T{{[0-9]+\.[XYZW], PV\.[XYZW]}} 104; EG: SIN * T{{[0-9]+\.[XYZW], PV\.[XYZW]}} 105; EG: SIN * T{{[0-9]+\.[XYZW], PV\.[XYZW]}} 106; EG-NOT: SIN 107 108; SI: v_sin_f32 109; SI: v_sin_f32 110; SI: v_sin_f32 111; SI: v_sin_f32 112; SI-NOT: v_sin_f32 113define void @sin_v4f32(<4 x float> addrspace(1)* %out, <4 x float> %vx) #1 { 114 %sin = call <4 x float> @llvm.sin.v4f32( <4 x float> %vx) 115 store <4 x float> %sin, <4 x float> addrspace(1)* %out 116 ret void 117} 118 119declare float @llvm.sin.f32(float) #0 120declare <4 x float> @llvm.sin.v4f32(<4 x float>) #0 121 122attributes #0 = { nounwind readnone } 123attributes #1 = { nounwind "unsafe-fp-math"="false" } 124attributes #2 = { nounwind "unsafe-fp-math"="true" } 125