blob: 27840b2e160948cdbcd1f36152983b156a118639 [file] [log] [blame]
Vincent Lejeunef940fd02013-02-14 16:57:19 +00001;RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck %s
2
Tom Stellard79243d92014-10-01 17:15:17 +00003; CHECK: {{^}}main1:
Tom Stellardfc455472013-08-12 22:33:21 +00004; CHECK: MOV * T{{[0-9]+\.[XYZW], KC0}}
Vincent Lejeune0a22bc42013-03-14 15:50:45 +00005define void @main1() {
Vincent Lejeunef940fd02013-02-14 16:57:19 +00006main_body:
Vincent Lejeune2bc27302013-03-08 15:34:07 +00007 %0 = load <4 x float> addrspace(8)* null
Vincent Lejeunef940fd02013-02-14 16:57:19 +00008 %1 = extractelement <4 x float> %0, i32 0
Vincent Lejeune2bc27302013-03-08 15:34:07 +00009 %2 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
Vincent Lejeunef940fd02013-02-14 16:57:19 +000010 %3 = extractelement <4 x float> %2, i32 0
Vincent Lejeune2bc27302013-03-08 15:34:07 +000011 %4 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
Vincent Lejeunef940fd02013-02-14 16:57:19 +000012 %5 = extractelement <4 x float> %4, i32 0
Tom Stellard0351ea22013-09-28 02:50:50 +000013 %6 = fcmp ogt float %1, 0.000000e+00
Vincent Lejeunef940fd02013-02-14 16:57:19 +000014 %7 = select i1 %6, float %3, float %5
Vincent Lejeune2bc27302013-03-08 15:34:07 +000015 %8 = load <4 x float> addrspace(8)* null
Vincent Lejeunef940fd02013-02-14 16:57:19 +000016 %9 = extractelement <4 x float> %8, i32 1
Vincent Lejeune2bc27302013-03-08 15:34:07 +000017 %10 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
Vincent Lejeunef940fd02013-02-14 16:57:19 +000018 %11 = extractelement <4 x float> %10, i32 1
Vincent Lejeune2bc27302013-03-08 15:34:07 +000019 %12 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
Vincent Lejeunef940fd02013-02-14 16:57:19 +000020 %13 = extractelement <4 x float> %12, i32 1
Tom Stellard0351ea22013-09-28 02:50:50 +000021 %14 = fcmp ogt float %9, 0.000000e+00
Vincent Lejeunef940fd02013-02-14 16:57:19 +000022 %15 = select i1 %14, float %11, float %13
Vincent Lejeune2bc27302013-03-08 15:34:07 +000023 %16 = load <4 x float> addrspace(8)* null
Vincent Lejeunef940fd02013-02-14 16:57:19 +000024 %17 = extractelement <4 x float> %16, i32 2
Vincent Lejeune2bc27302013-03-08 15:34:07 +000025 %18 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
Vincent Lejeunef940fd02013-02-14 16:57:19 +000026 %19 = extractelement <4 x float> %18, i32 2
Vincent Lejeune2bc27302013-03-08 15:34:07 +000027 %20 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
Vincent Lejeunef940fd02013-02-14 16:57:19 +000028 %21 = extractelement <4 x float> %20, i32 2
Tom Stellard0351ea22013-09-28 02:50:50 +000029 %22 = fcmp ogt float %17, 0.000000e+00
Vincent Lejeunef940fd02013-02-14 16:57:19 +000030 %23 = select i1 %22, float %19, float %21
Vincent Lejeune2bc27302013-03-08 15:34:07 +000031 %24 = load <4 x float> addrspace(8)* null
Vincent Lejeunef940fd02013-02-14 16:57:19 +000032 %25 = extractelement <4 x float> %24, i32 3
Vincent Lejeune2bc27302013-03-08 15:34:07 +000033 %26 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
Vincent Lejeunef940fd02013-02-14 16:57:19 +000034 %27 = extractelement <4 x float> %26, i32 3
Vincent Lejeune2bc27302013-03-08 15:34:07 +000035 %28 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
Vincent Lejeunef940fd02013-02-14 16:57:19 +000036 %29 = extractelement <4 x float> %28, i32 3
Tom Stellard0351ea22013-09-28 02:50:50 +000037 %30 = fcmp ogt float %25, 0.000000e+00
Vincent Lejeunef940fd02013-02-14 16:57:19 +000038 %31 = select i1 %30, float %27, float %29
39 %32 = call float @llvm.AMDIL.clamp.(float %7, float 0.000000e+00, float 1.000000e+00)
40 %33 = call float @llvm.AMDIL.clamp.(float %15, float 0.000000e+00, float 1.000000e+00)
41 %34 = call float @llvm.AMDIL.clamp.(float %23, float 0.000000e+00, float 1.000000e+00)
42 %35 = call float @llvm.AMDIL.clamp.(float %31, float 0.000000e+00, float 1.000000e+00)
43 %36 = insertelement <4 x float> undef, float %32, i32 0
44 %37 = insertelement <4 x float> %36, float %33, i32 1
45 %38 = insertelement <4 x float> %37, float %34, i32 2
46 %39 = insertelement <4 x float> %38, float %35, i32 3
47 call void @llvm.R600.store.swizzle(<4 x float> %39, i32 0, i32 0)
48 ret void
49}
50
Tom Stellard79243d92014-10-01 17:15:17 +000051; CHECK: {{^}}main2:
Vincent Lejeune0a22bc42013-03-14 15:50:45 +000052; CHECK-NOT: MOV
53define void @main2() {
54main_body:
55 %0 = load <4 x float> addrspace(8)* null
56 %1 = extractelement <4 x float> %0, i32 0
57 %2 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
58 %3 = extractelement <4 x float> %2, i32 0
59 %4 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
60 %5 = extractelement <4 x float> %4, i32 1
Tom Stellard0351ea22013-09-28 02:50:50 +000061 %6 = fcmp ogt float %1, 0.000000e+00
Vincent Lejeune0a22bc42013-03-14 15:50:45 +000062 %7 = select i1 %6, float %3, float %5
63 %8 = load <4 x float> addrspace(8)* null
64 %9 = extractelement <4 x float> %8, i32 1
65 %10 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
66 %11 = extractelement <4 x float> %10, i32 0
67 %12 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
68 %13 = extractelement <4 x float> %12, i32 1
Tom Stellard0351ea22013-09-28 02:50:50 +000069 %14 = fcmp ogt float %9, 0.000000e+00
Vincent Lejeune0a22bc42013-03-14 15:50:45 +000070 %15 = select i1 %14, float %11, float %13
71 %16 = load <4 x float> addrspace(8)* null
72 %17 = extractelement <4 x float> %16, i32 2
73 %18 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
74 %19 = extractelement <4 x float> %18, i32 3
75 %20 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
76 %21 = extractelement <4 x float> %20, i32 2
Tom Stellard0351ea22013-09-28 02:50:50 +000077 %22 = fcmp ogt float %17, 0.000000e+00
Vincent Lejeune0a22bc42013-03-14 15:50:45 +000078 %23 = select i1 %22, float %19, float %21
79 %24 = load <4 x float> addrspace(8)* null
80 %25 = extractelement <4 x float> %24, i32 3
81 %26 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
82 %27 = extractelement <4 x float> %26, i32 3
83 %28 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
84 %29 = extractelement <4 x float> %28, i32 2
Tom Stellard0351ea22013-09-28 02:50:50 +000085 %30 = fcmp ogt float %25, 0.000000e+00
Vincent Lejeune0a22bc42013-03-14 15:50:45 +000086 %31 = select i1 %30, float %27, float %29
87 %32 = call float @llvm.AMDIL.clamp.(float %7, float 0.000000e+00, float 1.000000e+00)
88 %33 = call float @llvm.AMDIL.clamp.(float %15, float 0.000000e+00, float 1.000000e+00)
89 %34 = call float @llvm.AMDIL.clamp.(float %23, float 0.000000e+00, float 1.000000e+00)
90 %35 = call float @llvm.AMDIL.clamp.(float %31, float 0.000000e+00, float 1.000000e+00)
91 %36 = insertelement <4 x float> undef, float %32, i32 0
92 %37 = insertelement <4 x float> %36, float %33, i32 1
93 %38 = insertelement <4 x float> %37, float %34, i32 2
94 %39 = insertelement <4 x float> %38, float %35, i32 3
95 call void @llvm.R600.store.swizzle(<4 x float> %39, i32 0, i32 0)
96 ret void
97}
98
Vincent Lejeunef940fd02013-02-14 16:57:19 +000099declare float @llvm.AMDIL.clamp.(float, float, float) readnone
100declare void @llvm.R600.store.swizzle(<4 x float>, i32, i32)