Matt Arsenault | e3862cd | 2016-07-26 23:25:44 +0000 | [diff] [blame^] | 1 | ; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=FUNC %s |
| 2 | ; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=FUNC %s |
| 3 | ; RUN: llc -march=r600 -mcpu=cypress -verify-machineinstrs < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s |
Matt Arsenault | bef34e2 | 2016-01-22 21:30:34 +0000 | [diff] [blame] | 4 | ; RUN: llc -march=r600 -mcpu=cayman -verify-machineinstrs < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s |
| 5 | |
Matt Arsenault | bef34e2 | 2016-01-22 21:30:34 +0000 | [diff] [blame] | 6 | ; FUNC-LABEL: {{^}}rcp_pat_f32: |
Matt Arsenault | e3862cd | 2016-07-26 23:25:44 +0000 | [diff] [blame^] | 7 | ; GCN: s_load_dword [[SRC:s[0-9]+]] |
| 8 | ; GCN: v_rcp_f32_e32 [[RCP:v[0-9]+]], [[SRC]] |
| 9 | ; GCN: buffer_store_dword [[RCP]] |
| 10 | |
Matt Arsenault | bef34e2 | 2016-01-22 21:30:34 +0000 | [diff] [blame] | 11 | ; EG: RECIP_IEEE |
Matt Arsenault | e3862cd | 2016-07-26 23:25:44 +0000 | [diff] [blame^] | 12 | define void @rcp_pat_f32(float addrspace(1)* %out, float %src) #0 { |
Matt Arsenault | bef34e2 | 2016-01-22 21:30:34 +0000 | [diff] [blame] | 13 | %rcp = fdiv float 1.0, %src |
| 14 | store float %rcp, float addrspace(1)* %out, align 4 |
| 15 | ret void |
| 16 | } |
Matt Arsenault | e3862cd | 2016-07-26 23:25:44 +0000 | [diff] [blame^] | 17 | |
| 18 | ; FUNC-LABEL: {{^}}rcp_ulp25_pat_f32: |
| 19 | ; GCN: s_load_dword [[SRC:s[0-9]+]] |
| 20 | ; GCN: v_rcp_f32_e32 [[RCP:v[0-9]+]], [[SRC]] |
| 21 | ; GCN: buffer_store_dword [[RCP]] |
| 22 | |
| 23 | ; EG: RECIP_IEEE |
| 24 | define void @rcp_ulp25_pat_f32(float addrspace(1)* %out, float %src) #0 { |
| 25 | %rcp = fdiv float 1.0, %src, !fpmath !0 |
| 26 | store float %rcp, float addrspace(1)* %out, align 4 |
| 27 | ret void |
| 28 | } |
| 29 | |
| 30 | ; FUNC-LABEL: {{^}}rcp_fast_ulp25_pat_f32: |
| 31 | ; GCN: s_load_dword [[SRC:s[0-9]+]] |
| 32 | ; GCN: v_rcp_f32_e32 [[RCP:v[0-9]+]], [[SRC]] |
| 33 | ; GCN: buffer_store_dword [[RCP]] |
| 34 | |
| 35 | ; EG: RECIP_IEEE |
| 36 | define void @rcp_fast_ulp25_pat_f32(float addrspace(1)* %out, float %src) #0 { |
| 37 | %rcp = fdiv fast float 1.0, %src, !fpmath !0 |
| 38 | store float %rcp, float addrspace(1)* %out, align 4 |
| 39 | ret void |
| 40 | } |
| 41 | |
| 42 | ; FUNC-LABEL: {{^}}rcp_arcp_ulp25_pat_f32: |
| 43 | ; GCN: s_load_dword [[SRC:s[0-9]+]] |
| 44 | ; GCN: v_rcp_f32_e32 [[RCP:v[0-9]+]], [[SRC]] |
| 45 | ; GCN: buffer_store_dword [[RCP]] |
| 46 | |
| 47 | ; EG: RECIP_IEEE |
| 48 | define void @rcp_arcp_ulp25_pat_f32(float addrspace(1)* %out, float %src) #0 { |
| 49 | %rcp = fdiv arcp float 1.0, %src, !fpmath !0 |
| 50 | store float %rcp, float addrspace(1)* %out, align 4 |
| 51 | ret void |
| 52 | } |
| 53 | |
| 54 | ; FUNC-LABEL: {{^}}rcp_global_fast_ulp25_pat_f32: |
| 55 | ; GCN: s_load_dword [[SRC:s[0-9]+]] |
| 56 | ; GCN: v_rcp_f32_e32 [[RCP:v[0-9]+]], [[SRC]] |
| 57 | ; GCN: buffer_store_dword [[RCP]] |
| 58 | |
| 59 | ; EG: RECIP_IEEE |
| 60 | define void @rcp_global_fast_ulp25_pat_f32(float addrspace(1)* %out, float %src) #2 { |
| 61 | %rcp = fdiv float 1.0, %src, !fpmath !0 |
| 62 | store float %rcp, float addrspace(1)* %out, align 4 |
| 63 | ret void |
| 64 | } |
| 65 | |
| 66 | ; FUNC-LABEL: {{^}}rcp_fabs_pat_f32: |
| 67 | ; GCN: s_load_dword [[SRC:s[0-9]+]] |
| 68 | ; GCN: v_rcp_f32_e64 [[RCP:v[0-9]+]], |[[SRC]]| |
| 69 | ; GCN: buffer_store_dword [[RCP]] |
| 70 | |
| 71 | ; EG: RECIP_IEEE |
| 72 | define void @rcp_fabs_pat_f32(float addrspace(1)* %out, float %src) #0 { |
| 73 | %src.fabs = call float @llvm.fabs.f32(float %src) |
| 74 | %rcp = fdiv float 1.0, %src.fabs |
| 75 | store float %rcp, float addrspace(1)* %out, align 4 |
| 76 | ret void |
| 77 | } |
| 78 | |
| 79 | ; FIXME: fneg folded into constant 1 |
| 80 | ; FUNC-LABEL: {{^}}rcp_fabs_fneg_pat_f32: |
| 81 | define void @rcp_fabs_fneg_pat_f32(float addrspace(1)* %out, float %src) #0 { |
| 82 | %src.fabs = call float @llvm.fabs.f32(float %src) |
| 83 | %src.fabs.fneg = fsub float -0.0, %src.fabs |
| 84 | %rcp = fdiv float 1.0, %src.fabs.fneg |
| 85 | store float %rcp, float addrspace(1)* %out, align 4 |
| 86 | ret void |
| 87 | } |
| 88 | |
| 89 | |
| 90 | declare float @llvm.fabs.f32(float) #1 |
| 91 | |
| 92 | attributes #0 = { nounwind "unsafe-fp-math"="false" } |
| 93 | attributes #1 = { nounwind readnone } |
| 94 | attributes #2 = { nounwind "unsafe-fp-math"="true" } |
| 95 | |
| 96 | !0 = !{float 2.500000e+00} |