diff options
| author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2016-01-22 18:42:38 +0000 |
|---|---|---|
| committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2016-01-22 18:42:38 +0000 |
| commit | 0cbaa1762bc2034bd2070615f62bcc8496a434ba (patch) | |
| tree | faf6eddbc9d7c4b1d0504039701b571cbc8847b3 /llvm/test | |
| parent | a584f0008a896e78bd418993443f4c08749003bc (diff) | |
| download | bcm5719-llvm-0cbaa1762bc2034bd2070615f62bcc8496a434ba.tar.gz bcm5719-llvm-0cbaa1762bc2034bd2070615f62bcc8496a434ba.zip | |
AMDGPU: Remove AMDGPU.fract intrinsic
Mesa doesn't use this, and this is pattern matched already
from fsub x, (ffloor x)
llvm-svn: 258513
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/CodeGen/AMDGPU/fract.f64.ll (renamed from llvm/test/CodeGen/AMDGPU/llvm.AMDGPU.fract.f64.ll) | 46 | ||||
| -rw-r--r-- | llvm/test/CodeGen/AMDGPU/fract.ll | 58 | ||||
| -rw-r--r-- | llvm/test/CodeGen/AMDGPU/llvm.AMDGPU.fract.ll | 49 | ||||
| -rw-r--r-- | llvm/test/CodeGen/AMDGPU/si-spill-cf.ll | 5 |
4 files changed, 87 insertions, 71 deletions
diff --git a/llvm/test/CodeGen/AMDGPU/llvm.AMDGPU.fract.f64.ll b/llvm/test/CodeGen/AMDGPU/fract.f64.ll index 6049dca0401..a19259fdf24 100644 --- a/llvm/test/CodeGen/AMDGPU/llvm.AMDGPU.fract.f64.ll +++ b/llvm/test/CodeGen/AMDGPU/fract.f64.ll @@ -1,9 +1,9 @@ -; RUN: llc -march=amdgcn -mcpu=SI -verify-machineinstrs -enable-unsafe-fp-math < %s | FileCheck -check-prefix=GCN -check-prefix=SI -check-prefix=FUNC %s -; RUN: llc -march=amdgcn -mcpu=bonaire -verify-machineinstrs -enable-unsafe-fp-math < %s | FileCheck -check-prefix=GCN -check-prefix=CI -check-prefix=FUNC %s -; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs -enable-unsafe-fp-math < %s | FileCheck -check-prefix=GCN -check-prefix=CI -check-prefix=FUNC %s +; RUN: llc -march=amdgcn -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=SI -check-prefix=FUNC %s +; RUN: llc -march=amdgcn -mcpu=bonaire -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=CI -check-prefix=FUNC %s +; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=CI -check-prefix=FUNC %s -declare double @llvm.fabs.f64(double %Val) -declare double @llvm.AMDGPU.fract.f64(double) nounwind readnone +declare double @llvm.fabs.f64(double) #0 +declare double @llvm.floor.f64(double) #0 ; FUNC-LABEL: {{^}}fract_f64: ; GCN: v_fract_f64_e32 [[FRC:v\[[0-9]+:[0-9]+\]]], v{{\[}}[[LO:[0-9]+]]:[[HI:[0-9]+]]] @@ -15,10 +15,11 @@ declare double @llvm.AMDGPU.fract.f64(double) nounwind readnone ; SI: v_cndmask_b32_e64 v[[RESHI:[0-9]+]], v[[MINHI]], v[[HI]], [[COND]] ; SI: buffer_store_dwordx2 v{{\[}}[[RESLO]]:[[RESHI]]] ; CI: buffer_store_dwordx2 [[FRC]] -define void @fract_f64(double addrspace(1)* %out, double addrspace(1)* %src) nounwind { - %val = load double, double addrspace(1)* %src, align 4 - %fract = call double @llvm.AMDGPU.fract.f64(double %val) nounwind readnone - store double %fract, double addrspace(1)* %out, align 4 +define void @fract_f64(double addrspace(1)* %out, double addrspace(1)* %src) #1 { + %x = load double, double addrspace(1)* %src + %floor.x = call double @llvm.floor.f64(double %x) + %fract = fsub double %x, %floor.x + store double %fract, double addrspace(1)* %out ret void } @@ -32,11 +33,12 @@ define void @fract_f64(double addrspace(1)* %out, double addrspace(1)* %src) nou ; SI: v_cndmask_b32_e64 v[[RESHI:[0-9]+]], v[[MINHI]], v[[HI]], [[COND]] ; SI: buffer_store_dwordx2 v{{\[}}[[RESLO]]:[[RESHI]]] ; CI: buffer_store_dwordx2 [[FRC]] -define void @fract_f64_neg(double addrspace(1)* %out, double addrspace(1)* %src) nounwind { - %val = load double, double addrspace(1)* %src, align 4 - %neg = fsub double 0.0, %val - %fract = call double @llvm.AMDGPU.fract.f64(double %neg) nounwind readnone - store double %fract, double addrspace(1)* %out, align 4 +define void @fract_f64_neg(double addrspace(1)* %out, double addrspace(1)* %src) #1 { + %x = load double, double addrspace(1)* %src + %neg.x = fsub double -0.0, %x + %floor.neg.x = call double @llvm.floor.f64(double %neg.x) + %fract = fsub double %neg.x, %floor.neg.x + store double %fract, double addrspace(1)* %out ret void } @@ -50,11 +52,15 @@ define void @fract_f64_neg(double addrspace(1)* %out, double addrspace(1)* %src) ; SI: v_cndmask_b32_e64 v[[RESHI:[0-9]+]], v[[MINHI]], v[[HI]], [[COND]] ; SI: buffer_store_dwordx2 v{{\[}}[[RESLO]]:[[RESHI]]] ; CI: buffer_store_dwordx2 [[FRC]] -define void @fract_f64_neg_abs(double addrspace(1)* %out, double addrspace(1)* %src) nounwind { - %val = load double, double addrspace(1)* %src, align 4 - %abs = call double @llvm.fabs.f64(double %val) - %neg = fsub double 0.0, %abs - %fract = call double @llvm.AMDGPU.fract.f64(double %neg) nounwind readnone - store double %fract, double addrspace(1)* %out, align 4 +define void @fract_f64_neg_abs(double addrspace(1)* %out, double addrspace(1)* %src) #1 { + %x = load double, double addrspace(1)* %src + %abs.x = call double @llvm.fabs.f64(double %x) + %neg.abs.x = fsub double -0.0, %abs.x + %floor.neg.abs.x = call double @llvm.floor.f64(double %neg.abs.x) + %fract = fsub double %neg.abs.x, %floor.neg.abs.x + store double %fract, double addrspace(1)* %out ret void } + +attributes #0 = { nounwind readnone } +attributes #1 = { nounwind } diff --git a/llvm/test/CodeGen/AMDGPU/fract.ll b/llvm/test/CodeGen/AMDGPU/fract.ll new file mode 100644 index 00000000000..5434248c634 --- /dev/null +++ b/llvm/test/CodeGen/AMDGPU/fract.ll @@ -0,0 +1,58 @@ +; RUN: llc -march=amdgcn -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=SI -check-prefix=FUNC %s +; RUN: llc -march=amdgcn -mcpu=bonaire -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=CI -check-prefix=FUNC %s +; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=CI -check-prefix=FUNC %s +; XUN: llc -march=r600 -mcpu=cypress -verify-machineinstrs < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s + +declare float @llvm.fabs.f32(float) #0 +declare float @llvm.floor.f32(float) #0 + +; FUNC-LABEL: {{^}}fract_f32: +; CI: v_fract_f32_e32 [[RESULT:v[0-9]+]], [[INPUT:v[0-9]+]] +; SI: v_floor_f32_e32 [[FLR:v[0-9]+]], [[INPUT:v[0-9]+]] +; SI: v_subrev_f32_e32 [[RESULT:v[0-9]+]], [[FLR]], [[INPUT]] +; GCN: buffer_store_dword [[RESULT]] + +; XEG: FRACT +define void @fract_f32(float addrspace(1)* %out, float addrspace(1)* %src) #1 { + %x = load float, float addrspace(1)* %src + %floor.x = call float @llvm.floor.f32(float %x) + %fract = fsub float %x, %floor.x + store float %fract, float addrspace(1)* %out + ret void +} + +; FUNC-LABEL: {{^}}fract_f32_neg: +; CI: v_fract_f32_e64 [[RESULT:v[0-9]+]], -[[INPUT:v[0-9]+]] +; SI: v_floor_f32_e64 [[FLR:v[0-9]+]], -[[INPUT:v[0-9]+]] +; SI: v_sub_f32_e64 [[RESULT:v[0-9]+]], -[[INPUT]], [[FLR]] +; GCN: buffer_store_dword [[RESULT]] + +; XEG: FRACT +define void @fract_f32_neg(float addrspace(1)* %out, float addrspace(1)* %src) #1 { + %x = load float, float addrspace(1)* %src + %x.neg = fsub float -0.0, %x + %floor.x.neg = call float @llvm.floor.f32(float %x.neg) + %fract = fsub float %x.neg, %floor.x.neg + store float %fract, float addrspace(1)* %out + ret void +} + +; FUNC-LABEL: {{^}}fract_f32_neg_abs: +; CI: v_fract_f32_e64 [[RESULT:v[0-9]+]], -|[[INPUT:v[0-9]+]]| +; SI: v_floor_f32_e64 [[FLR:v[0-9]+]], -|[[INPUT:v[0-9]+]]| +; SI: v_sub_f32_e64 [[RESULT:v[0-9]+]], -|[[INPUT]]|, [[FLR]] +; GCN: buffer_store_dword [[RESULT]] + +; XEG: FRACT +define void @fract_f32_neg_abs(float addrspace(1)* %out, float addrspace(1)* %src) #1 { + %x = load float, float addrspace(1)* %src + %abs.x = call float @llvm.fabs.f32(float %x) + %neg.abs.x = fsub float -0.0, %abs.x + %floor.neg.abs.x = call float @llvm.floor.f32(float %neg.abs.x) + %fract = fsub float %neg.abs.x, %floor.neg.abs.x + store float %fract, float addrspace(1)* %out + ret void +} + +attributes #0 = { nounwind readnone } +attributes #1 = { nounwind } diff --git a/llvm/test/CodeGen/AMDGPU/llvm.AMDGPU.fract.ll b/llvm/test/CodeGen/AMDGPU/llvm.AMDGPU.fract.ll deleted file mode 100644 index c53837a7e44..00000000000 --- a/llvm/test/CodeGen/AMDGPU/llvm.AMDGPU.fract.ll +++ /dev/null @@ -1,49 +0,0 @@ -; RUN: llc -march=amdgcn -mcpu=SI -verify-machineinstrs -enable-unsafe-fp-math < %s | FileCheck -check-prefix=GCN -check-prefix=SI -check-prefix=FUNC %s -; RUN: llc -march=amdgcn -mcpu=bonaire -verify-machineinstrs -enable-unsafe-fp-math < %s | FileCheck -check-prefix=GCN -check-prefix=CI -check-prefix=FUNC %s -; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs -enable-unsafe-fp-math < %s | FileCheck -check-prefix=GCN -check-prefix=CI -check-prefix=FUNC %s -; RUN: llc -march=r600 -mcpu=cypress -verify-machineinstrs -enable-unsafe-fp-math < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s - -declare float @llvm.fabs.f32(float %Val) -declare float @llvm.AMDGPU.fract.f32(float) nounwind readnone - -; FUNC-LABEL: {{^}}fract_f32: -; CI: v_fract_f32_e32 [[RESULT:v[0-9]+]], [[INPUT:v[0-9]+]] -; SI: v_floor_f32_e32 [[FLR:v[0-9]+]], [[INPUT:v[0-9]+]] -; SI: v_subrev_f32_e32 [[RESULT:v[0-9]+]], [[FLR]], [[INPUT]] -; GCN: buffer_store_dword [[RESULT]] -; EG: FRACT -define void @fract_f32(float addrspace(1)* %out, float addrspace(1)* %src) nounwind { - %val = load float, float addrspace(1)* %src, align 4 - %fract = call float @llvm.AMDGPU.fract.f32(float %val) nounwind readnone - store float %fract, float addrspace(1)* %out, align 4 - ret void -} - -; FUNC-LABEL: {{^}}fract_f32_neg: -; CI: v_fract_f32_e64 [[RESULT:v[0-9]+]], -[[INPUT:v[0-9]+]] -; SI: v_floor_f32_e64 [[FLR:v[0-9]+]], -[[INPUT:v[0-9]+]] -; SI: v_sub_f32_e64 [[RESULT:v[0-9]+]], -[[INPUT]], [[FLR]] -; GCN: buffer_store_dword [[RESULT]] -; EG: FRACT -define void @fract_f32_neg(float addrspace(1)* %out, float addrspace(1)* %src) nounwind { - %val = load float, float addrspace(1)* %src, align 4 - %neg = fsub float 0.0, %val - %fract = call float @llvm.AMDGPU.fract.f32(float %neg) nounwind readnone - store float %fract, float addrspace(1)* %out, align 4 - ret void -} - -; FUNC-LABEL: {{^}}fract_f32_neg_abs: -; CI: v_fract_f32_e64 [[RESULT:v[0-9]+]], -|[[INPUT:v[0-9]+]]| -; SI: v_floor_f32_e64 [[FLR:v[0-9]+]], -|[[INPUT:v[0-9]+]]| -; SI: v_sub_f32_e64 [[RESULT:v[0-9]+]], -|[[INPUT]]|, [[FLR]] -; GCN: buffer_store_dword [[RESULT]] -; EG: FRACT -define void @fract_f32_neg_abs(float addrspace(1)* %out, float addrspace(1)* %src) nounwind { - %val = load float, float addrspace(1)* %src, align 4 - %abs = call float @llvm.fabs.f32(float %val) - %neg = fsub float 0.0, %abs - %fract = call float @llvm.AMDGPU.fract.f32(float %neg) nounwind readnone - store float %fract, float addrspace(1)* %out, align 4 - ret void -} diff --git a/llvm/test/CodeGen/AMDGPU/si-spill-cf.ll b/llvm/test/CodeGen/AMDGPU/si-spill-cf.ll index 2cb919f1634..b6f1b8236b2 100644 --- a/llvm/test/CodeGen/AMDGPU/si-spill-cf.ll +++ b/llvm/test/CodeGen/AMDGPU/si-spill-cf.ll @@ -256,7 +256,8 @@ ELSE2584: ; preds = %IF2565 ENDIF2582: ; preds = %ELSE2584, %IF2565 %213 = fadd float %1, undef %214 = fadd float 0.000000e+00, %213 - %215 = call float @llvm.AMDGPU.fract.f32(float %214) + %floor = call float @llvm.floor.f32(float %214) + %215 = fsub float %214, %floor br i1 undef, label %IF2589, label %ELSE2590 IF2589: ; preds = %ENDIF2582 @@ -480,7 +481,7 @@ ELSE2824: ; preds = %ELSE2821 declare float @llvm.SI.load.const(<16 x i8>, i32) #1 ; Function Attrs: nounwind readnone -declare float @llvm.AMDGPU.fract.f32(float) #1 +declare float @llvm.floor.f32(float) #1 ; Function Attrs: nounwind readnone declare float @llvm.sqrt.f32(float) #1 |

