blob: cc8a8829a98b4ccd9655af2f682aaeec5fc7526b [file] [log] [blame]
Tom Stellard919bb6b2014-04-29 23:12:53 +00001; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs< %s | FileCheck -check-prefix=SI %s
Matt Arsenault470acd82014-04-15 22:28:39 +00002
Tom Stellard79243d92014-10-01 17:15:17 +00003; SI-LABEL: {{^}}global_copy_i1_to_i1:
Tom Stellard326d6ec2014-11-05 14:50:53 +00004; SI: buffer_load_ubyte
5; SI: v_and_b32_e32 v{{[0-9]+}}, 1
6; SI: buffer_store_byte
7; SI: s_endpgm
Matt Arsenault470acd82014-04-15 22:28:39 +00008define void @global_copy_i1_to_i1(i1 addrspace(1)* %out, i1 addrspace(1)* %in) nounwind {
9 %load = load i1 addrspace(1)* %in
10 store i1 %load, i1 addrspace(1)* %out, align 1
11 ret void
12}
13
Matt Arsenaultb7ebdff2014-11-23 02:57:50 +000014; SI-LABEL: {{^}}local_copy_i1_to_i1:
15; SI: ds_read_u8
16; SI: v_and_b32_e32 v{{[0-9]+}}, 1
17; SI: ds_write_b8
18; SI: s_endpgm
19define void @local_copy_i1_to_i1(i1 addrspace(3)* %out, i1 addrspace(3)* %in) nounwind {
20 %load = load i1 addrspace(3)* %in
21 store i1 %load, i1 addrspace(3)* %out, align 1
22 ret void
23}
24
25; SI-LABEL: {{^}}constant_copy_i1_to_i1:
26; SI: buffer_load_ubyte
27; SI: v_and_b32_e32 v{{[0-9]+}}, 1
28; SI: buffer_store_byte
29; SI: s_endpgm
30define void @constant_copy_i1_to_i1(i1 addrspace(1)* %out, i1 addrspace(2)* %in) nounwind {
31 %load = load i1 addrspace(2)* %in
32 store i1 %load, i1 addrspace(1)* %out, align 1
33 ret void
34}
35
Tom Stellard79243d92014-10-01 17:15:17 +000036; SI-LABEL: {{^}}global_sextload_i1_to_i32:
Matt Arsenault79db0a72014-11-23 02:57:49 +000037; SI: buffer_load_ubyte
38; SI: v_bfe_i32
Tom Stellard326d6ec2014-11-05 14:50:53 +000039; SI: buffer_store_dword
40; SI: s_endpgm
Matt Arsenault470acd82014-04-15 22:28:39 +000041define void @global_sextload_i1_to_i32(i32 addrspace(1)* %out, i1 addrspace(1)* %in) nounwind {
42 %load = load i1 addrspace(1)* %in
43 %ext = sext i1 %load to i32
44 store i32 %ext, i32 addrspace(1)* %out, align 4
45 ret void
46}
47
Tom Stellard79243d92014-10-01 17:15:17 +000048; SI-LABEL: {{^}}global_zextload_i1_to_i32:
Tom Stellard326d6ec2014-11-05 14:50:53 +000049; SI: buffer_load_ubyte
50; SI: buffer_store_dword
51; SI: s_endpgm
Matt Arsenault470acd82014-04-15 22:28:39 +000052define void @global_zextload_i1_to_i32(i32 addrspace(1)* %out, i1 addrspace(1)* %in) nounwind {
53 %load = load i1 addrspace(1)* %in
54 %ext = zext i1 %load to i32
55 store i32 %ext, i32 addrspace(1)* %out, align 4
56 ret void
57}
58
Tom Stellard79243d92014-10-01 17:15:17 +000059; SI-LABEL: {{^}}global_sextload_i1_to_i64:
Matt Arsenault79db0a72014-11-23 02:57:49 +000060; SI: buffer_load_ubyte
61; SI: v_bfe_i32
Tom Stellard326d6ec2014-11-05 14:50:53 +000062; SI: buffer_store_dwordx2
63; SI: s_endpgm
Matt Arsenault470acd82014-04-15 22:28:39 +000064define void @global_sextload_i1_to_i64(i64 addrspace(1)* %out, i1 addrspace(1)* %in) nounwind {
65 %load = load i1 addrspace(1)* %in
66 %ext = sext i1 %load to i64
67 store i64 %ext, i64 addrspace(1)* %out, align 4
68 ret void
69}
70
Tom Stellard79243d92014-10-01 17:15:17 +000071; SI-LABEL: {{^}}global_zextload_i1_to_i64:
Tom Stellard326d6ec2014-11-05 14:50:53 +000072; SI: buffer_load_ubyte
Matt Arsenault79db0a72014-11-23 02:57:49 +000073; SI: v_mov_b32_e32 {{v[0-9]+}}, 0
Tom Stellard326d6ec2014-11-05 14:50:53 +000074; SI: buffer_store_dwordx2
75; SI: s_endpgm
Matt Arsenault470acd82014-04-15 22:28:39 +000076define void @global_zextload_i1_to_i64(i64 addrspace(1)* %out, i1 addrspace(1)* %in) nounwind {
77 %load = load i1 addrspace(1)* %in
78 %ext = zext i1 %load to i64
79 store i64 %ext, i64 addrspace(1)* %out, align 4
80 ret void
81}
82
Tom Stellard79243d92014-10-01 17:15:17 +000083; SI-LABEL: {{^}}i1_arg:
Tom Stellard326d6ec2014-11-05 14:50:53 +000084; SI: buffer_load_ubyte
85; SI: v_and_b32_e32
86; SI: buffer_store_byte
87; SI: s_endpgm
Matt Arsenault470acd82014-04-15 22:28:39 +000088define void @i1_arg(i1 addrspace(1)* %out, i1 %x) nounwind {
89 store i1 %x, i1 addrspace(1)* %out, align 1
90 ret void
91}
92
Tom Stellard79243d92014-10-01 17:15:17 +000093; SI-LABEL: {{^}}i1_arg_zext_i32:
Tom Stellard326d6ec2014-11-05 14:50:53 +000094; SI: buffer_load_ubyte
95; SI: buffer_store_dword
96; SI: s_endpgm
Matt Arsenault470acd82014-04-15 22:28:39 +000097define void @i1_arg_zext_i32(i32 addrspace(1)* %out, i1 %x) nounwind {
98 %ext = zext i1 %x to i32
99 store i32 %ext, i32 addrspace(1)* %out, align 4
100 ret void
101}
102
Tom Stellard79243d92014-10-01 17:15:17 +0000103; SI-LABEL: {{^}}i1_arg_zext_i64:
Tom Stellard326d6ec2014-11-05 14:50:53 +0000104; SI: buffer_load_ubyte
105; SI: buffer_store_dwordx2
106; SI: s_endpgm
Matt Arsenault470acd82014-04-15 22:28:39 +0000107define void @i1_arg_zext_i64(i64 addrspace(1)* %out, i1 %x) nounwind {
108 %ext = zext i1 %x to i64
109 store i64 %ext, i64 addrspace(1)* %out, align 8
110 ret void
111}
112
Tom Stellard79243d92014-10-01 17:15:17 +0000113; SI-LABEL: {{^}}i1_arg_sext_i32:
Matt Arsenault79db0a72014-11-23 02:57:49 +0000114; SI: buffer_load_ubyte
Tom Stellard326d6ec2014-11-05 14:50:53 +0000115; SI: buffer_store_dword
116; SI: s_endpgm
Matt Arsenault470acd82014-04-15 22:28:39 +0000117define void @i1_arg_sext_i32(i32 addrspace(1)* %out, i1 %x) nounwind {
118 %ext = sext i1 %x to i32
119 store i32 %ext, i32addrspace(1)* %out, align 4
120 ret void
121}
122
Tom Stellard79243d92014-10-01 17:15:17 +0000123; SI-LABEL: {{^}}i1_arg_sext_i64:
Matt Arsenault79db0a72014-11-23 02:57:49 +0000124; SI: buffer_load_ubyte
125; SI: v_bfe_i32
126; SI: v_ashrrev_i32
Tom Stellard326d6ec2014-11-05 14:50:53 +0000127; SI: buffer_store_dwordx2
128; SI: s_endpgm
Matt Arsenault470acd82014-04-15 22:28:39 +0000129define void @i1_arg_sext_i64(i64 addrspace(1)* %out, i1 %x) nounwind {
130 %ext = sext i1 %x to i64
131 store i64 %ext, i64 addrspace(1)* %out, align 8
132 ret void
133}