mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-08 19:06:39 +00:00
7c9c6ed761
Essentially the same as the GEP change in r230786. A similar migration script can be used to update test cases, though a few more test case improvements/changes were required this time around: (r229269-r229278) import fileinput import sys import re pat = re.compile(r"((?:=|:|^)\s*load (?:atomic )?(?:volatile )?(.*?))(| addrspace\(\d+\) *)\*($| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$)") for line in sys.stdin: sys.stdout.write(re.sub(pat, r"\1, \2\3*\4", line)) Reviewers: rafael, dexonsmith, grosser Differential Revision: http://reviews.llvm.org/D7649 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230794 91177308-0d34-0410-b5e6-96231b3b80d8
200 lines
9.0 KiB
LLVM
200 lines
9.0 KiB
LLVM
; RUN: llc -march=amdgcn -mcpu=SI -verify-machineinstrs < %s | FileCheck %s
|
|
|
|
declare float @llvm.fmuladd.f32(float, float, float)
|
|
declare double @llvm.fmuladd.f64(double, double, double)
|
|
declare i32 @llvm.r600.read.tidig.x() nounwind readnone
|
|
declare float @llvm.fabs.f32(float) nounwind readnone
|
|
|
|
; CHECK-LABEL: {{^}}fmuladd_f32:
|
|
; CHECK: v_mad_f32 {{v[0-9]+, v[0-9]+, v[0-9]+, v[0-9]+}}
|
|
|
|
define void @fmuladd_f32(float addrspace(1)* %out, float addrspace(1)* %in1,
|
|
float addrspace(1)* %in2, float addrspace(1)* %in3) {
|
|
%r0 = load float, float addrspace(1)* %in1
|
|
%r1 = load float, float addrspace(1)* %in2
|
|
%r2 = load float, float addrspace(1)* %in3
|
|
%r3 = tail call float @llvm.fmuladd.f32(float %r0, float %r1, float %r2)
|
|
store float %r3, float addrspace(1)* %out
|
|
ret void
|
|
}
|
|
|
|
; CHECK-LABEL: {{^}}fmuladd_f64:
|
|
; CHECK: v_fma_f64 {{v\[[0-9]+:[0-9]+\], v\[[0-9]+:[0-9]+\], v\[[0-9]+:[0-9]+\], v\[[0-9]+:[0-9]+\]}}
|
|
|
|
define void @fmuladd_f64(double addrspace(1)* %out, double addrspace(1)* %in1,
|
|
double addrspace(1)* %in2, double addrspace(1)* %in3) {
|
|
%r0 = load double, double addrspace(1)* %in1
|
|
%r1 = load double, double addrspace(1)* %in2
|
|
%r2 = load double, double addrspace(1)* %in3
|
|
%r3 = tail call double @llvm.fmuladd.f64(double %r0, double %r1, double %r2)
|
|
store double %r3, double addrspace(1)* %out
|
|
ret void
|
|
}
|
|
|
|
; CHECK-LABEL: {{^}}fmuladd_2.0_a_b_f32
|
|
; CHECK-DAG: buffer_load_dword [[R1:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64{{$}}
|
|
; CHECK-DAG: buffer_load_dword [[R2:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64 offset:4
|
|
; CHECK: v_mad_f32 [[RESULT:v[0-9]+]], 2.0, [[R1]], [[R2]]
|
|
; CHECK: buffer_store_dword [[RESULT]]
|
|
define void @fmuladd_2.0_a_b_f32(float addrspace(1)* %out, float addrspace(1)* %in) {
|
|
%tid = call i32 @llvm.r600.read.tidig.x() nounwind readnone
|
|
%gep.0 = getelementptr float, float addrspace(1)* %out, i32 %tid
|
|
%gep.1 = getelementptr float, float addrspace(1)* %gep.0, i32 1
|
|
%gep.out = getelementptr float, float addrspace(1)* %out, i32 %tid
|
|
|
|
%r1 = load float, float addrspace(1)* %gep.0
|
|
%r2 = load float, float addrspace(1)* %gep.1
|
|
|
|
%r3 = tail call float @llvm.fmuladd.f32(float 2.0, float %r1, float %r2)
|
|
store float %r3, float addrspace(1)* %gep.out
|
|
ret void
|
|
}
|
|
|
|
; CHECK-LABEL: {{^}}fmuladd_a_2.0_b_f32
|
|
; CHECK-DAG: buffer_load_dword [[R1:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64{{$}}
|
|
; CHECK-DAG: buffer_load_dword [[R2:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64 offset:4
|
|
; CHECK: v_mad_f32 [[RESULT:v[0-9]+]], 2.0, [[R1]], [[R2]]
|
|
; CHECK: buffer_store_dword [[RESULT]]
|
|
define void @fmuladd_a_2.0_b_f32(float addrspace(1)* %out, float addrspace(1)* %in) {
|
|
%tid = call i32 @llvm.r600.read.tidig.x() nounwind readnone
|
|
%gep.0 = getelementptr float, float addrspace(1)* %out, i32 %tid
|
|
%gep.1 = getelementptr float, float addrspace(1)* %gep.0, i32 1
|
|
%gep.out = getelementptr float, float addrspace(1)* %out, i32 %tid
|
|
|
|
%r1 = load float, float addrspace(1)* %gep.0
|
|
%r2 = load float, float addrspace(1)* %gep.1
|
|
|
|
%r3 = tail call float @llvm.fmuladd.f32(float %r1, float 2.0, float %r2)
|
|
store float %r3, float addrspace(1)* %gep.out
|
|
ret void
|
|
}
|
|
|
|
; CHECK-LABEL: {{^}}fadd_a_a_b_f32:
|
|
; CHECK-DAG: buffer_load_dword [[R1:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64{{$}}
|
|
; CHECK-DAG: buffer_load_dword [[R2:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64 offset:4
|
|
; CHECK: v_mad_f32 [[RESULT:v[0-9]+]], 2.0, [[R1]], [[R2]]
|
|
; CHECK: buffer_store_dword [[RESULT]]
|
|
define void @fadd_a_a_b_f32(float addrspace(1)* %out,
|
|
float addrspace(1)* %in1,
|
|
float addrspace(1)* %in2) {
|
|
%tid = call i32 @llvm.r600.read.tidig.x() nounwind readnone
|
|
%gep.0 = getelementptr float, float addrspace(1)* %out, i32 %tid
|
|
%gep.1 = getelementptr float, float addrspace(1)* %gep.0, i32 1
|
|
%gep.out = getelementptr float, float addrspace(1)* %out, i32 %tid
|
|
|
|
%r0 = load float, float addrspace(1)* %gep.0
|
|
%r1 = load float, float addrspace(1)* %gep.1
|
|
|
|
%add.0 = fadd float %r0, %r0
|
|
%add.1 = fadd float %add.0, %r1
|
|
store float %add.1, float addrspace(1)* %out
|
|
ret void
|
|
}
|
|
|
|
; CHECK-LABEL: {{^}}fadd_b_a_a_f32:
|
|
; CHECK-DAG: buffer_load_dword [[R1:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64{{$}}
|
|
; CHECK-DAG: buffer_load_dword [[R2:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64 offset:4
|
|
; CHECK: v_mad_f32 [[RESULT:v[0-9]+]], 2.0, [[R1]], [[R2]]
|
|
; CHECK: buffer_store_dword [[RESULT]]
|
|
define void @fadd_b_a_a_f32(float addrspace(1)* %out,
|
|
float addrspace(1)* %in1,
|
|
float addrspace(1)* %in2) {
|
|
%tid = call i32 @llvm.r600.read.tidig.x() nounwind readnone
|
|
%gep.0 = getelementptr float, float addrspace(1)* %out, i32 %tid
|
|
%gep.1 = getelementptr float, float addrspace(1)* %gep.0, i32 1
|
|
%gep.out = getelementptr float, float addrspace(1)* %out, i32 %tid
|
|
|
|
%r0 = load float, float addrspace(1)* %gep.0
|
|
%r1 = load float, float addrspace(1)* %gep.1
|
|
|
|
%add.0 = fadd float %r0, %r0
|
|
%add.1 = fadd float %r1, %add.0
|
|
store float %add.1, float addrspace(1)* %out
|
|
ret void
|
|
}
|
|
|
|
; CHECK-LABEL: {{^}}fmuladd_neg_2.0_a_b_f32
|
|
; CHECK-DAG: buffer_load_dword [[R1:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64{{$}}
|
|
; CHECK-DAG: buffer_load_dword [[R2:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64 offset:4
|
|
; CHECK: v_mad_f32 [[RESULT:v[0-9]+]], -2.0, [[R1]], [[R2]]
|
|
; CHECK: buffer_store_dword [[RESULT]]
|
|
define void @fmuladd_neg_2.0_a_b_f32(float addrspace(1)* %out, float addrspace(1)* %in) {
|
|
%tid = call i32 @llvm.r600.read.tidig.x() nounwind readnone
|
|
%gep.0 = getelementptr float, float addrspace(1)* %out, i32 %tid
|
|
%gep.1 = getelementptr float, float addrspace(1)* %gep.0, i32 1
|
|
%gep.out = getelementptr float, float addrspace(1)* %out, i32 %tid
|
|
|
|
%r1 = load float, float addrspace(1)* %gep.0
|
|
%r2 = load float, float addrspace(1)* %gep.1
|
|
|
|
%r3 = tail call float @llvm.fmuladd.f32(float -2.0, float %r1, float %r2)
|
|
store float %r3, float addrspace(1)* %gep.out
|
|
ret void
|
|
}
|
|
|
|
|
|
; CHECK-LABEL: {{^}}fmuladd_neg_2.0_neg_a_b_f32
|
|
; CHECK-DAG: buffer_load_dword [[R1:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64{{$}}
|
|
; CHECK-DAG: buffer_load_dword [[R2:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64 offset:4
|
|
; CHECK: v_mad_f32 [[RESULT:v[0-9]+]], 2.0, [[R1]], [[R2]]
|
|
; CHECK: buffer_store_dword [[RESULT]]
|
|
define void @fmuladd_neg_2.0_neg_a_b_f32(float addrspace(1)* %out, float addrspace(1)* %in) {
|
|
%tid = call i32 @llvm.r600.read.tidig.x() nounwind readnone
|
|
%gep.0 = getelementptr float, float addrspace(1)* %out, i32 %tid
|
|
%gep.1 = getelementptr float, float addrspace(1)* %gep.0, i32 1
|
|
%gep.out = getelementptr float, float addrspace(1)* %out, i32 %tid
|
|
|
|
%r1 = load float, float addrspace(1)* %gep.0
|
|
%r2 = load float, float addrspace(1)* %gep.1
|
|
|
|
%r1.fneg = fsub float -0.000000e+00, %r1
|
|
|
|
%r3 = tail call float @llvm.fmuladd.f32(float -2.0, float %r1.fneg, float %r2)
|
|
store float %r3, float addrspace(1)* %gep.out
|
|
ret void
|
|
}
|
|
|
|
|
|
; CHECK-LABEL: {{^}}fmuladd_2.0_neg_a_b_f32
|
|
; CHECK-DAG: buffer_load_dword [[R1:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64{{$}}
|
|
; CHECK-DAG: buffer_load_dword [[R2:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64 offset:4
|
|
; CHECK: v_mad_f32 [[RESULT:v[0-9]+]], -2.0, [[R1]], [[R2]]
|
|
; CHECK: buffer_store_dword [[RESULT]]
|
|
define void @fmuladd_2.0_neg_a_b_f32(float addrspace(1)* %out, float addrspace(1)* %in) {
|
|
%tid = call i32 @llvm.r600.read.tidig.x() nounwind readnone
|
|
%gep.0 = getelementptr float, float addrspace(1)* %out, i32 %tid
|
|
%gep.1 = getelementptr float, float addrspace(1)* %gep.0, i32 1
|
|
%gep.out = getelementptr float, float addrspace(1)* %out, i32 %tid
|
|
|
|
%r1 = load float, float addrspace(1)* %gep.0
|
|
%r2 = load float, float addrspace(1)* %gep.1
|
|
|
|
%r1.fneg = fsub float -0.000000e+00, %r1
|
|
|
|
%r3 = tail call float @llvm.fmuladd.f32(float 2.0, float %r1.fneg, float %r2)
|
|
store float %r3, float addrspace(1)* %gep.out
|
|
ret void
|
|
}
|
|
|
|
|
|
; CHECK-LABEL: {{^}}fmuladd_2.0_a_neg_b_f32
|
|
; CHECK-DAG: buffer_load_dword [[R1:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64{{$}}
|
|
; CHECK-DAG: buffer_load_dword [[R2:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64 offset:4
|
|
; CHECK: v_mad_f32 [[RESULT:v[0-9]+]], 2.0, [[R1]], -[[R2]]
|
|
; CHECK: buffer_store_dword [[RESULT]]
|
|
define void @fmuladd_2.0_a_neg_b_f32(float addrspace(1)* %out, float addrspace(1)* %in) {
|
|
%tid = call i32 @llvm.r600.read.tidig.x() nounwind readnone
|
|
%gep.0 = getelementptr float, float addrspace(1)* %out, i32 %tid
|
|
%gep.1 = getelementptr float, float addrspace(1)* %gep.0, i32 1
|
|
%gep.out = getelementptr float, float addrspace(1)* %out, i32 %tid
|
|
|
|
%r1 = load float, float addrspace(1)* %gep.0
|
|
%r2 = load float, float addrspace(1)* %gep.1
|
|
|
|
%r2.fneg = fsub float -0.000000e+00, %r2
|
|
|
|
%r3 = tail call float @llvm.fmuladd.f32(float 2.0, float %r1, float %r2.fneg)
|
|
store float %r3, float addrspace(1)* %gep.out
|
|
ret void
|
|
}
|