1 ; RUN: llc -march=amdgcn -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s 2 ; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s 3 ; RUN: llc -march=r600 -mcpu=cypress -verify-machineinstrs < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s 4 5 ; FUNC-LABEL: {{^}}global_copy_i1_to_i1: 6 ; SI: buffer_load_ubyte 7 ; SI: v_and_b32_e32 v{{[0-9]+}}, 1 8 ; SI: buffer_store_byte 9 ; SI: s_endpgm 10 11 ; EG: VTX_READ_8 12 ; EG: AND_INT 13 define void @global_copy_i1_to_i1(i1 addrspace(1)* %out, i1 addrspace(1)* %in) nounwind { 14 %load = load i1, i1 addrspace(1)* %in 15 store i1 %load, i1 addrspace(1)* %out, align 1 16 ret void 17 } 18 19 ; FUNC-LABEL: {{^}}local_copy_i1_to_i1: 20 ; SI: ds_read_u8 21 ; SI: v_and_b32_e32 v{{[0-9]+}}, 1 22 ; SI: ds_write_b8 23 ; SI: s_endpgm 24 25 ; EG: LDS_UBYTE_READ_RET 26 ; EG: AND_INT 27 ; EG: LDS_BYTE_WRITE 28 define void @local_copy_i1_to_i1(i1 addrspace(3)* %out, i1 addrspace(3)* %in) nounwind { 29 %load = load i1, i1 addrspace(3)* %in 30 store i1 %load, i1 addrspace(3)* %out, align 1 31 ret void 32 } 33 34 ; FUNC-LABEL: {{^}}constant_copy_i1_to_i1: 35 ; SI: buffer_load_ubyte 36 ; SI: v_and_b32_e32 v{{[0-9]+}}, 1 37 ; SI: buffer_store_byte 38 ; SI: s_endpgm 39 40 ; EG: VTX_READ_8 41 ; EG: AND_INT 42 define void @constant_copy_i1_to_i1(i1 addrspace(1)* %out, i1 addrspace(2)* %in) nounwind { 43 %load = load i1, i1 addrspace(2)* %in 44 store i1 %load, i1 addrspace(1)* %out, align 1 45 ret void 46 } 47 48 ; FUNC-LABEL: {{^}}global_sextload_i1_to_i32: 49 ; SI: buffer_load_ubyte 50 ; SI: v_bfe_i32 51 ; SI: buffer_store_dword 52 ; SI: s_endpgm 53 54 ; EG: VTX_READ_8 55 ; EG: BFE_INT 56 define void @global_sextload_i1_to_i32(i32 addrspace(1)* %out, i1 addrspace(1)* %in) nounwind { 57 %load = load i1, i1 addrspace(1)* %in 58 %ext = sext i1 %load to i32 59 store i32 %ext, i32 addrspace(1)* %out, align 4 60 ret void 61 } 62 63 ; FUNC-LABEL: {{^}}global_zextload_i1_to_i32: 64 ; SI: buffer_load_ubyte 65 ; SI: buffer_store_dword 66 ; SI: s_endpgm 67 68 define void @global_zextload_i1_to_i32(i32 addrspace(1)* %out, i1 addrspace(1)* %in) nounwind { 69 %load = load i1, i1 addrspace(1)* %in 70 %ext = zext i1 %load to i32 71 store i32 %ext, i32 addrspace(1)* %out, align 4 72 ret void 73 } 74 75 ; FUNC-LABEL: {{^}}global_sextload_i1_to_i64: 76 ; SI: buffer_load_ubyte 77 ; SI: v_bfe_i32 78 ; SI: buffer_store_dwordx2 79 ; SI: s_endpgm 80 define void @global_sextload_i1_to_i64(i64 addrspace(1)* %out, i1 addrspace(1)* %in) nounwind { 81 %load = load i1, i1 addrspace(1)* %in 82 %ext = sext i1 %load to i64 83 store i64 %ext, i64 addrspace(1)* %out, align 4 84 ret void 85 } 86 87 ; FUNC-LABEL: {{^}}global_zextload_i1_to_i64: 88 ; SI: buffer_load_ubyte 89 ; SI: v_mov_b32_e32 {{v[0-9]+}}, 0 90 ; SI: buffer_store_dwordx2 91 ; SI: s_endpgm 92 define void @global_zextload_i1_to_i64(i64 addrspace(1)* %out, i1 addrspace(1)* %in) nounwind { 93 %load = load i1, i1 addrspace(1)* %in 94 %ext = zext i1 %load to i64 95 store i64 %ext, i64 addrspace(1)* %out, align 4 96 ret void 97 } 98 99 ; FUNC-LABEL: {{^}}i1_arg: 100 ; SI: buffer_load_ubyte 101 ; SI: v_and_b32_e32 102 ; SI: buffer_store_byte 103 ; SI: s_endpgm 104 define void @i1_arg(i1 addrspace(1)* %out, i1 %x) nounwind { 105 store i1 %x, i1 addrspace(1)* %out, align 1 106 ret void 107 } 108 109 ; FUNC-LABEL: {{^}}i1_arg_zext_i32: 110 ; SI: buffer_load_ubyte 111 ; SI: buffer_store_dword 112 ; SI: s_endpgm 113 define void @i1_arg_zext_i32(i32 addrspace(1)* %out, i1 %x) nounwind { 114 %ext = zext i1 %x to i32 115 store i32 %ext, i32 addrspace(1)* %out, align 4 116 ret void 117 } 118 119 ; FUNC-LABEL: {{^}}i1_arg_zext_i64: 120 ; SI: buffer_load_ubyte 121 ; SI: buffer_store_dwordx2 122 ; SI: s_endpgm 123 define void @i1_arg_zext_i64(i64 addrspace(1)* %out, i1 %x) nounwind { 124 %ext = zext i1 %x to i64 125 store i64 %ext, i64 addrspace(1)* %out, align 8 126 ret void 127 } 128 129 ; FUNC-LABEL: {{^}}i1_arg_sext_i32: 130 ; SI: buffer_load_ubyte 131 ; SI: buffer_store_dword 132 ; SI: s_endpgm 133 define void @i1_arg_sext_i32(i32 addrspace(1)* %out, i1 %x) nounwind { 134 %ext = sext i1 %x to i32 135 store i32 %ext, i32addrspace(1)* %out, align 4 136 ret void 137 } 138 139 ; FUNC-LABEL: {{^}}i1_arg_sext_i64: 140 ; SI: buffer_load_ubyte 141 ; SI: v_bfe_i32 142 ; SI: v_ashrrev_i32 143 ; SI: buffer_store_dwordx2 144 ; SI: s_endpgm 145 define void @i1_arg_sext_i64(i64 addrspace(1)* %out, i1 %x) nounwind { 146 %ext = sext i1 %x to i64 147 store i64 %ext, i64 addrspace(1)* %out, align 8 148 ret void 149 } 150