diff options
| author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2017-10-13 21:10:22 +0000 |
|---|---|---|
| committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2017-10-13 21:10:22 +0000 |
| commit | e11d8aca77dcdd17a8a25bdf84f0e13d57e53d41 (patch) | |
| tree | 84ac8959676371349d6635df3c0b2dbafb839d37 /llvm/test/CodeGen/AMDGPU/fabs.ll | |
| parent | 868783e85557dde30923fab94c7ffabf5e271818 (diff) | |
| download | bcm5719-llvm-e11d8aca77dcdd17a8a25bdf84f0e13d57e53d41.tar.gz bcm5719-llvm-e11d8aca77dcdd17a8a25bdf84f0e13d57e53d41.zip | |
AMDGPU: Implement hasBitPreservingFPLogic
llvm-svn: 315754
Diffstat (limited to 'llvm/test/CodeGen/AMDGPU/fabs.ll')
| -rw-r--r-- | llvm/test/CodeGen/AMDGPU/fabs.ll | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/llvm/test/CodeGen/AMDGPU/fabs.ll b/llvm/test/CodeGen/AMDGPU/fabs.ll index 600c6cd8230..550ad7956c9 100644 --- a/llvm/test/CodeGen/AMDGPU/fabs.ll +++ b/llvm/test/CodeGen/AMDGPU/fabs.ll @@ -83,7 +83,7 @@ define amdgpu_kernel void @fabs_fn_fold(float addrspace(1)* %out, float %in0, fl ret void } -; GCN-LABEL: {{^}}fabs_fold: +; FUNC-LABEL: {{^}}fabs_fold: ; SI: s_load_dword [[ABS_VALUE:s[0-9]+]], s[{{[0-9]+:[0-9]+}}], 0xb ; VI: s_load_dword [[ABS_VALUE:s[0-9]+]], s[{{[0-9]+:[0-9]+}}], 0x2c ; GCN-NOT: and @@ -95,6 +95,18 @@ define amdgpu_kernel void @fabs_fold(float addrspace(1)* %out, float %in0, float ret void } +; Make sure we turn some integer operations back into fabs +; FUNC-LABEL: {{^}}bitpreserve_fabs_f32: +; GCN: v_add_f32_e64 v{{[0-9]+}}, |s{{[0-9]+}}|, 1.0 +define amdgpu_kernel void @bitpreserve_fabs_f32(float addrspace(1)* %out, float %in) { + %in.bc = bitcast float %in to i32 + %int.abs = and i32 %in.bc, 2147483647 + %bc = bitcast i32 %int.abs to float + %fadd = fadd float %bc, 1.0 + store float %fadd, float addrspace(1)* %out + ret void +} + declare float @fabs(float) readnone declare float @llvm.fabs.f32(float) readnone declare <2 x float> @llvm.fabs.v2f32(<2 x float>) readnone |

