summaryrefslogtreecommitdiff
path: root/test/CodeGen
diff options
context:
space:
mode:
authorVincent Lejeune <vljn@ovi.com>2013-07-31 19:32:07 +0000
committerVincent Lejeune <vljn@ovi.com>2013-07-31 19:32:07 +0000
commit8e37705a736f45c16ed82ca675f7e413aa3bf90e (patch)
tree218951ee7c1cecdef61d95b438abe80275b8fc6e /test/CodeGen
parent98ce62780ea7185ba710868bf83c8077e8d7f6d6 (diff)
downloadllvm-8e37705a736f45c16ed82ca675f7e413aa3bf90e.tar.gz
llvm-8e37705a736f45c16ed82ca675f7e413aa3bf90e.tar.bz2
llvm-8e37705a736f45c16ed82ca675f7e413aa3bf90e.tar.xz
R600: Avoid more than 4 literals in the same instruction group at scheduling
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187515 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen')
-rw-r--r--test/CodeGen/R600/max-literals.ll68
1 files changed, 68 insertions, 0 deletions
diff --git a/test/CodeGen/R600/max-literals.ll b/test/CodeGen/R600/max-literals.ll
new file mode 100644
index 0000000000..c31b7c06bb
--- /dev/null
+++ b/test/CodeGen/R600/max-literals.ll
@@ -0,0 +1,68 @@
+;RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck %s
+
+; CHECK: @main
+; CHECK: ADD *
+
+define void @main() #0 {
+main_body:
+ %0 = call float @llvm.R600.load.input(i32 4)
+ %1 = call float @llvm.R600.load.input(i32 5)
+ %2 = call float @llvm.R600.load.input(i32 6)
+ %3 = call float @llvm.R600.load.input(i32 7)
+ %4 = call float @llvm.R600.load.input(i32 8)
+ %5 = fadd float %0, 2.0
+ %6 = fadd float %1, 3.0
+ %7 = fadd float %2, 4.0
+ %8 = fadd float %3, 5.0
+ %9 = bitcast float %4 to i32
+ %10 = mul i32 %9, 6
+ %11 = bitcast i32 %10 to float
+ %12 = insertelement <4 x float> undef, float %5, i32 0
+ %13 = insertelement <4 x float> %12, float %6, i32 1
+ %14 = insertelement <4 x float> %13, float %7, i32 2
+ %15 = insertelement <4 x float> %14, float %8, i32 3
+ %16 = insertelement <4 x float> %15, float %11, i32 3
+
+ %17 = call float @llvm.AMDGPU.dp4(<4 x float> %15,<4 x float> %16)
+ %18 = insertelement <4 x float> undef, float %17, i32 0
+ call void @llvm.R600.store.swizzle(<4 x float> %18, i32 0, i32 2)
+ ret void
+}
+
+; CHECK: @main
+; CHECK-NOT: ADD *
+
+define void @main2() #0 {
+main_body:
+ %0 = call float @llvm.R600.load.input(i32 4)
+ %1 = call float @llvm.R600.load.input(i32 5)
+ %2 = call float @llvm.R600.load.input(i32 6)
+ %3 = call float @llvm.R600.load.input(i32 7)
+ %4 = call float @llvm.R600.load.input(i32 8)
+ %5 = fadd float %0, 2.0
+ %6 = fadd float %1, 3.0
+ %7 = fadd float %2, 4.0
+ %8 = fadd float %3, 2.0
+ %9 = bitcast float %4 to i32
+ %10 = mul i32 %9, 6
+ %11 = bitcast i32 %10 to float
+ %12 = insertelement <4 x float> undef, float %5, i32 0
+ %13 = insertelement <4 x float> %12, float %6, i32 1
+ %14 = insertelement <4 x float> %13, float %7, i32 2
+ %15 = insertelement <4 x float> %14, float %8, i32 3
+ %16 = insertelement <4 x float> %15, float %11, i32 3
+
+ %17 = call float @llvm.AMDGPU.dp4(<4 x float> %15,<4 x float> %16)
+ %18 = insertelement <4 x float> undef, float %17, i32 0
+ call void @llvm.R600.store.swizzle(<4 x float> %18, i32 0, i32 2)
+ ret void
+}
+
+; Function Attrs: readnone
+declare float @llvm.R600.load.input(i32) #1
+declare float @llvm.AMDGPU.dp4(<4 x float>, <4 x float>) #1
+
+declare void @llvm.R600.store.swizzle(<4 x float>, i32, i32)
+
+attributes #0 = { "ShaderType"="1" }
+attributes #1 = { readnone }