2015-02-03 21:53:27 +00:00
|
|
|
; RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck --check-prefix=R600 --check-prefix=FUNC %s
|
|
|
|
; RUN: llc < %s -march=r600 -mcpu=cayman | FileCheck --check-prefix=R600 --check-prefix=FUNC %s
|
|
|
|
; RUN: llc < %s -march=amdgcn -mcpu=SI -verify-machineinstrs | FileCheck --check-prefix=SI --check-prefix=FUNC %s
|
|
|
|
; RUN: llc < %s -march=amdgcn -mcpu=tonga -verify-machineinstrs | FileCheck --check-prefix=SI --check-prefix=FUNC %s
|
2013-04-19 02:10:53 +00:00
|
|
|
|
2013-07-23 23:54:56 +00:00
|
|
|
;===------------------------------------------------------------------------===;
|
|
|
|
; GLOBAL ADDRESS SPACE
|
|
|
|
;===------------------------------------------------------------------------===;
|
|
|
|
|
2013-04-19 02:10:53 +00:00
|
|
|
; Load an i8 value from the global address space.
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_i8:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: VTX_READ_8 T{{[0-9]+\.X, T[0-9]+\.X}}
|
2013-04-19 02:10:53 +00:00
|
|
|
|
2015-02-03 21:53:27 +00:00
|
|
|
; SI: buffer_load_ubyte v{{[0-9]+}},
|
2013-04-19 02:10:53 +00:00
|
|
|
define void @load_i8(i32 addrspace(1)* %out, i8 addrspace(1)* %in) {
|
2015-02-27 21:17:42 +00:00
|
|
|
%1 = load i8, i8 addrspace(1)* %in
|
2013-04-19 02:10:53 +00:00
|
|
|
%2 = zext i8 %1 to i32
|
|
|
|
store i32 %2, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_i8_sext:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: VTX_READ_8 [[DST:T[0-9]\.[XYZW]]], [[DST]]
|
2015-05-26 18:07:22 +00:00
|
|
|
; R600: BFE_INT {{[* ]*}}T{{[0-9].[XYZW]}}, [[DST]], 0.0, literal
|
|
|
|
; R600: 8
|
2015-02-03 21:53:27 +00:00
|
|
|
; SI: buffer_load_sbyte
|
2013-07-23 01:48:35 +00:00
|
|
|
define void @load_i8_sext(i32 addrspace(1)* %out, i8 addrspace(1)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load i8, i8 addrspace(1)* %in
|
2013-07-23 01:48:35 +00:00
|
|
|
%1 = sext i8 %0 to i32
|
|
|
|
store i32 %1, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_v2i8:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: VTX_READ_8
|
|
|
|
; R600: VTX_READ_8
|
|
|
|
; SI: buffer_load_ubyte
|
|
|
|
; SI: buffer_load_ubyte
|
2013-08-16 01:12:16 +00:00
|
|
|
define void @load_v2i8(<2 x i32> addrspace(1)* %out, <2 x i8> addrspace(1)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load <2 x i8>, <2 x i8> addrspace(1)* %in
|
2013-08-16 01:12:16 +00:00
|
|
|
%1 = zext <2 x i8> %0 to <2 x i32>
|
|
|
|
store <2 x i32> %1, <2 x i32> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_v2i8_sext:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600-DAG: VTX_READ_8 [[DST_X:T[0-9]\.[XYZW]]], [[DST_X]]
|
|
|
|
; R600-DAG: VTX_READ_8 [[DST_Y:T[0-9]\.[XYZW]]], [[DST_Y]]
|
2015-05-26 18:07:22 +00:00
|
|
|
; R600-DAG: BFE_INT {{[* ]*}}T{{[0-9].[XYZW]}}, [[DST_X]], 0.0, literal
|
|
|
|
; R600-DAG: BFE_INT {{[* ]*}}T{{[0-9].[XYZW]}}, [[DST_Y]], 0.0, literal
|
|
|
|
; R600-DAG: 8
|
|
|
|
; R600-DAG: 8
|
|
|
|
|
2015-02-03 21:53:27 +00:00
|
|
|
; SI: buffer_load_sbyte
|
|
|
|
; SI: buffer_load_sbyte
|
2013-08-16 01:12:16 +00:00
|
|
|
define void @load_v2i8_sext(<2 x i32> addrspace(1)* %out, <2 x i8> addrspace(1)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load <2 x i8>, <2 x i8> addrspace(1)* %in
|
2013-08-16 01:12:16 +00:00
|
|
|
%1 = sext <2 x i8> %0 to <2 x i32>
|
|
|
|
store <2 x i32> %1, <2 x i32> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_v4i8:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: VTX_READ_8
|
|
|
|
; R600: VTX_READ_8
|
|
|
|
; R600: VTX_READ_8
|
|
|
|
; R600: VTX_READ_8
|
|
|
|
; SI: buffer_load_ubyte
|
|
|
|
; SI: buffer_load_ubyte
|
|
|
|
; SI: buffer_load_ubyte
|
|
|
|
; SI: buffer_load_ubyte
|
2013-08-16 01:12:16 +00:00
|
|
|
define void @load_v4i8(<4 x i32> addrspace(1)* %out, <4 x i8> addrspace(1)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load <4 x i8>, <4 x i8> addrspace(1)* %in
|
2013-08-16 01:12:16 +00:00
|
|
|
%1 = zext <4 x i8> %0 to <4 x i32>
|
|
|
|
store <4 x i32> %1, <4 x i32> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_v4i8_sext:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600-DAG: VTX_READ_8 [[DST_X:T[0-9]\.[XYZW]]], [[DST_X]]
|
|
|
|
; R600-DAG: VTX_READ_8 [[DST_Y:T[0-9]\.[XYZW]]], [[DST_Y]]
|
|
|
|
; R600-DAG: VTX_READ_8 [[DST_Z:T[0-9]\.[XYZW]]], [[DST_Z]]
|
|
|
|
; R600-DAG: VTX_READ_8 [[DST_W:T[0-9]\.[XYZW]]], [[DST_W]]
|
2015-05-26 18:07:22 +00:00
|
|
|
; R600-DAG: BFE_INT {{[* ]*}}T{{[0-9].[XYZW]}}, [[DST_X]], 0.0, literal
|
|
|
|
; R600-DAG: BFE_INT {{[* ]*}}T{{[0-9].[XYZW]}}, [[DST_Y]], 0.0, literal
|
|
|
|
; R600-DAG: BFE_INT {{[* ]*}}T{{[0-9].[XYZW]}}, [[DST_Z]], 0.0, literal
|
|
|
|
; R600-DAG: BFE_INT {{[* ]*}}T{{[0-9].[XYZW]}}, [[DST_W]], 0.0, literal
|
|
|
|
; R600-DAG: 8
|
|
|
|
; R600-DAG: 8
|
|
|
|
; R600-DAG: 8
|
|
|
|
; R600-DAG: 8
|
2015-02-03 21:53:27 +00:00
|
|
|
; SI: buffer_load_sbyte
|
|
|
|
; SI: buffer_load_sbyte
|
|
|
|
; SI: buffer_load_sbyte
|
|
|
|
; SI: buffer_load_sbyte
|
2013-08-16 01:12:16 +00:00
|
|
|
define void @load_v4i8_sext(<4 x i32> addrspace(1)* %out, <4 x i8> addrspace(1)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load <4 x i8>, <4 x i8> addrspace(1)* %in
|
2013-08-16 01:12:16 +00:00
|
|
|
%1 = sext <4 x i8> %0 to <4 x i32>
|
|
|
|
store <4 x i32> %1, <4 x i32> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-07-23 01:48:35 +00:00
|
|
|
; Load an i16 value from the global address space.
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_i16:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: VTX_READ_16 T{{[0-9]+\.X, T[0-9]+\.X}}
|
|
|
|
; SI: buffer_load_ushort
|
2013-07-23 01:48:35 +00:00
|
|
|
define void @load_i16(i32 addrspace(1)* %out, i16 addrspace(1)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load i16 , i16 addrspace(1)* %in
|
2013-07-23 01:48:35 +00:00
|
|
|
%1 = zext i16 %0 to i32
|
|
|
|
store i32 %1, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_i16_sext:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: VTX_READ_16 [[DST:T[0-9]\.[XYZW]]], [[DST]]
|
2015-05-26 18:07:22 +00:00
|
|
|
; R600: BFE_INT {{[* ]*}}T{{[0-9].[XYZW]}}, [[DST]], 0.0, literal
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: 16
|
|
|
|
; SI: buffer_load_sshort
|
2013-07-23 01:48:35 +00:00
|
|
|
define void @load_i16_sext(i32 addrspace(1)* %out, i16 addrspace(1)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load i16, i16 addrspace(1)* %in
|
2013-07-23 01:48:35 +00:00
|
|
|
%1 = sext i16 %0 to i32
|
|
|
|
store i32 %1, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_v2i16:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: VTX_READ_16
|
|
|
|
; R600: VTX_READ_16
|
|
|
|
; SI: buffer_load_ushort
|
|
|
|
; SI: buffer_load_ushort
|
2013-08-16 01:12:16 +00:00
|
|
|
define void @load_v2i16(<2 x i32> addrspace(1)* %out, <2 x i16> addrspace(1)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load <2 x i16>, <2 x i16> addrspace(1)* %in
|
2013-08-16 01:12:16 +00:00
|
|
|
%1 = zext <2 x i16> %0 to <2 x i32>
|
|
|
|
store <2 x i32> %1, <2 x i32> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_v2i16_sext:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600-DAG: VTX_READ_16 [[DST_X:T[0-9]\.[XYZW]]], [[DST_X]]
|
|
|
|
; R600-DAG: VTX_READ_16 [[DST_Y:T[0-9]\.[XYZW]]], [[DST_Y]]
|
2015-05-26 18:07:22 +00:00
|
|
|
; R600-DAG: BFE_INT {{[* ]*}}T{{[0-9].[XYZW]}}, [[DST_X]], 0.0, literal
|
|
|
|
; R600-DAG: BFE_INT {{[* ]*}}T{{[0-9].[XYZW]}}, [[DST_Y]], 0.0, literal
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600-DAG: 16
|
|
|
|
; R600-DAG: 16
|
|
|
|
; SI: buffer_load_sshort
|
|
|
|
; SI: buffer_load_sshort
|
2013-08-16 01:12:16 +00:00
|
|
|
define void @load_v2i16_sext(<2 x i32> addrspace(1)* %out, <2 x i16> addrspace(1)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load <2 x i16>, <2 x i16> addrspace(1)* %in
|
2013-08-16 01:12:16 +00:00
|
|
|
%1 = sext <2 x i16> %0 to <2 x i32>
|
|
|
|
store <2 x i32> %1, <2 x i32> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_v4i16:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: VTX_READ_16
|
|
|
|
; R600: VTX_READ_16
|
|
|
|
; R600: VTX_READ_16
|
|
|
|
; R600: VTX_READ_16
|
|
|
|
; SI: buffer_load_ushort
|
|
|
|
; SI: buffer_load_ushort
|
|
|
|
; SI: buffer_load_ushort
|
|
|
|
; SI: buffer_load_ushort
|
2013-08-16 01:12:16 +00:00
|
|
|
define void @load_v4i16(<4 x i32> addrspace(1)* %out, <4 x i16> addrspace(1)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load <4 x i16>, <4 x i16> addrspace(1)* %in
|
2013-08-16 01:12:16 +00:00
|
|
|
%1 = zext <4 x i16> %0 to <4 x i32>
|
|
|
|
store <4 x i32> %1, <4 x i32> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_v4i16_sext:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600-DAG: VTX_READ_16 [[DST_X:T[0-9]\.[XYZW]]], [[DST_X]]
|
|
|
|
; R600-DAG: VTX_READ_16 [[DST_Y:T[0-9]\.[XYZW]]], [[DST_Y]]
|
|
|
|
; R600-DAG: VTX_READ_16 [[DST_Z:T[0-9]\.[XYZW]]], [[DST_Z]]
|
|
|
|
; R600-DAG: VTX_READ_16 [[DST_W:T[0-9]\.[XYZW]]], [[DST_W]]
|
2015-05-26 18:07:22 +00:00
|
|
|
; R600-DAG: BFE_INT {{[* ]*}}T{{[0-9].[XYZW]}}, [[DST_X]], 0.0, literal
|
|
|
|
; R600-DAG: BFE_INT {{[* ]*}}T{{[0-9].[XYZW]}}, [[DST_Y]], 0.0, literal
|
|
|
|
; R600-DAG: BFE_INT {{[* ]*}}T{{[0-9].[XYZW]}}, [[DST_Z]], 0.0, literal
|
|
|
|
; R600-DAG: BFE_INT {{[* ]*}}T{{[0-9].[XYZW]}}, [[DST_W]], 0.0, literal
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600-DAG: 16
|
|
|
|
; R600-DAG: 16
|
|
|
|
; R600-DAG: 16
|
|
|
|
; R600-DAG: 16
|
|
|
|
; SI: buffer_load_sshort
|
|
|
|
; SI: buffer_load_sshort
|
|
|
|
; SI: buffer_load_sshort
|
|
|
|
; SI: buffer_load_sshort
|
2013-08-16 01:12:16 +00:00
|
|
|
define void @load_v4i16_sext(<4 x i32> addrspace(1)* %out, <4 x i16> addrspace(1)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load <4 x i16>, <4 x i16> addrspace(1)* %in
|
2013-08-16 01:12:16 +00:00
|
|
|
%1 = sext <4 x i16> %0 to <4 x i32>
|
|
|
|
store <4 x i32> %1, <4 x i32> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-06-03 17:39:43 +00:00
|
|
|
; load an i32 value from the global address space.
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_i32:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: VTX_READ_32 T{{[0-9]+}}.X, T{{[0-9]+}}.X, 0
|
2013-06-03 17:39:43 +00:00
|
|
|
|
2015-02-03 21:53:27 +00:00
|
|
|
; SI: buffer_load_dword v{{[0-9]+}}
|
2013-06-03 17:39:43 +00:00
|
|
|
define void @load_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load i32, i32 addrspace(1)* %in
|
2013-06-03 17:39:43 +00:00
|
|
|
store i32 %0, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; load a f32 value from the global address space.
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_f32:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: VTX_READ_32 T{{[0-9]+}}.X, T{{[0-9]+}}.X, 0
|
2013-06-03 17:39:43 +00:00
|
|
|
|
2015-02-03 21:53:27 +00:00
|
|
|
; SI: buffer_load_dword v{{[0-9]+}}
|
2013-06-03 17:39:43 +00:00
|
|
|
define void @load_f32(float addrspace(1)* %out, float addrspace(1)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load float, float addrspace(1)* %in
|
2013-06-03 17:39:43 +00:00
|
|
|
store float %0, float addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-07-18 21:43:48 +00:00
|
|
|
; load a v2f32 value from the global address space
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_v2f32:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: MEM_RAT
|
|
|
|
; R600: VTX_READ_64
|
|
|
|
; SI: buffer_load_dwordx2
|
2013-07-18 21:43:48 +00:00
|
|
|
define void @load_v2f32(<2 x float> addrspace(1)* %out, <2 x float> addrspace(1)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load <2 x float>, <2 x float> addrspace(1)* %in
|
2013-07-18 21:43:48 +00:00
|
|
|
store <2 x float> %0, <2 x float> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_i64:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: VTX_READ_64
|
|
|
|
; SI: buffer_load_dwordx2
|
2013-07-15 19:00:09 +00:00
|
|
|
define void @load_i64(i64 addrspace(1)* %out, i64 addrspace(1)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load i64, i64 addrspace(1)* %in
|
2013-07-15 19:00:09 +00:00
|
|
|
store i64 %0, i64 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_i64_sext:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: MEM_RAT
|
|
|
|
; R600: MEM_RAT
|
|
|
|
; R600: ASHR {{[* ]*}}T{{[0-9]\.[XYZW]}}, T{{[0-9]\.[XYZW]}}, literal.x
|
|
|
|
; R600: 31
|
|
|
|
; SI: buffer_load_dword
|
2013-07-15 19:00:09 +00:00
|
|
|
|
|
|
|
define void @load_i64_sext(i64 addrspace(1)* %out, i32 addrspace(1)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load i32, i32 addrspace(1)* %in
|
2013-07-15 19:00:09 +00:00
|
|
|
%1 = sext i32 %0 to i64
|
|
|
|
store i64 %1, i64 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_i64_zext:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: MEM_RAT
|
|
|
|
; R600: MEM_RAT
|
2013-07-15 19:00:09 +00:00
|
|
|
define void @load_i64_zext(i64 addrspace(1)* %out, i32 addrspace(1)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load i32, i32 addrspace(1)* %in
|
2013-07-15 19:00:09 +00:00
|
|
|
%1 = zext i32 %0 to i64
|
|
|
|
store i64 %1, i64 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
2013-07-23 23:54:56 +00:00
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_v8i32:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: VTX_READ_128
|
|
|
|
; R600: VTX_READ_128
|
2014-02-13 23:34:10 +00:00
|
|
|
; XXX: We should be using DWORDX4 instructions on SI.
|
2015-02-03 21:53:27 +00:00
|
|
|
; SI: buffer_load_dword
|
|
|
|
; SI: buffer_load_dword
|
|
|
|
; SI: buffer_load_dword
|
|
|
|
; SI: buffer_load_dword
|
|
|
|
; SI: buffer_load_dword
|
|
|
|
; SI: buffer_load_dword
|
|
|
|
; SI: buffer_load_dword
|
|
|
|
; SI: buffer_load_dword
|
2014-02-13 23:34:10 +00:00
|
|
|
define void @load_v8i32(<8 x i32> addrspace(1)* %out, <8 x i32> addrspace(1)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load <8 x i32>, <8 x i32> addrspace(1)* %in
|
2014-02-13 23:34:10 +00:00
|
|
|
store <8 x i32> %0, <8 x i32> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_v16i32:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: VTX_READ_128
|
|
|
|
; R600: VTX_READ_128
|
|
|
|
; R600: VTX_READ_128
|
|
|
|
; R600: VTX_READ_128
|
2014-02-13 23:34:10 +00:00
|
|
|
; XXX: We should be using DWORDX4 instructions on SI.
|
2015-02-03 21:53:27 +00:00
|
|
|
; SI: buffer_load_dword
|
|
|
|
; SI: buffer_load_dword
|
|
|
|
; SI: buffer_load_dword
|
|
|
|
; SI: buffer_load_dword
|
|
|
|
; SI: buffer_load_dword
|
|
|
|
; SI: buffer_load_dword
|
|
|
|
; SI: buffer_load_dword
|
|
|
|
; SI: buffer_load_dword
|
|
|
|
; SI: buffer_load_dword
|
|
|
|
; SI: buffer_load_dword
|
|
|
|
; SI: buffer_load_dword
|
|
|
|
; SI: buffer_load_dword
|
|
|
|
; SI: buffer_load_dword
|
|
|
|
; SI: buffer_load_dword
|
|
|
|
; SI: buffer_load_dword
|
|
|
|
; SI: buffer_load_dword
|
2014-02-13 23:34:10 +00:00
|
|
|
define void @load_v16i32(<16 x i32> addrspace(1)* %out, <16 x i32> addrspace(1)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load <16 x i32>, <16 x i32> addrspace(1)* %in
|
2014-02-13 23:34:10 +00:00
|
|
|
store <16 x i32> %0, <16 x i32> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-07-23 23:54:56 +00:00
|
|
|
;===------------------------------------------------------------------------===;
|
|
|
|
; CONSTANT ADDRESS SPACE
|
|
|
|
;===------------------------------------------------------------------------===;
|
|
|
|
|
|
|
|
; Load a sign-extended i8 value
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_const_i8_sext:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: VTX_READ_8 [[DST:T[0-9]\.[XYZW]]], [[DST]]
|
2015-05-26 18:07:22 +00:00
|
|
|
; R600: BFE_INT {{[* ]*}}T{{[0-9].[XYZW]}}, [[DST]], 0.0, literal
|
|
|
|
; R600: 8
|
2015-02-03 21:53:27 +00:00
|
|
|
; SI: buffer_load_sbyte v{{[0-9]+}},
|
2013-07-23 23:54:56 +00:00
|
|
|
define void @load_const_i8_sext(i32 addrspace(1)* %out, i8 addrspace(2)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load i8, i8 addrspace(2)* %in
|
2013-07-23 23:54:56 +00:00
|
|
|
%1 = sext i8 %0 to i32
|
|
|
|
store i32 %1, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Load an aligned i8 value
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_const_i8_aligned:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: VTX_READ_8 T{{[0-9]+\.X, T[0-9]+\.X}}
|
|
|
|
; SI: buffer_load_ubyte v{{[0-9]+}},
|
2013-07-23 23:54:56 +00:00
|
|
|
define void @load_const_i8_aligned(i32 addrspace(1)* %out, i8 addrspace(2)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load i8, i8 addrspace(2)* %in
|
2013-07-23 23:54:56 +00:00
|
|
|
%1 = zext i8 %0 to i32
|
|
|
|
store i32 %1, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Load an un-aligned i8 value
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_const_i8_unaligned:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: VTX_READ_8 T{{[0-9]+\.X, T[0-9]+\.X}}
|
|
|
|
; SI: buffer_load_ubyte v{{[0-9]+}},
|
2013-07-23 23:54:56 +00:00
|
|
|
define void @load_const_i8_unaligned(i32 addrspace(1)* %out, i8 addrspace(2)* %in) {
|
|
|
|
entry:
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230786 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-27 19:29:02 +00:00
|
|
|
%0 = getelementptr i8, i8 addrspace(2)* %in, i32 1
|
2015-02-27 21:17:42 +00:00
|
|
|
%1 = load i8, i8 addrspace(2)* %0
|
2013-07-23 23:54:56 +00:00
|
|
|
%2 = zext i8 %1 to i32
|
|
|
|
store i32 %2, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Load a sign-extended i16 value
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_const_i16_sext:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: VTX_READ_16 [[DST:T[0-9]\.[XYZW]]], [[DST]]
|
2015-05-26 18:07:22 +00:00
|
|
|
; R600: BFE_INT {{[* ]*}}T{{[0-9].[XYZW]}}, [[DST]], 0.0, literal
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: 16
|
|
|
|
; SI: buffer_load_sshort
|
2013-07-23 23:54:56 +00:00
|
|
|
define void @load_const_i16_sext(i32 addrspace(1)* %out, i16 addrspace(2)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load i16, i16 addrspace(2)* %in
|
2013-07-23 23:54:56 +00:00
|
|
|
%1 = sext i16 %0 to i32
|
|
|
|
store i32 %1, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Load an aligned i16 value
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_const_i16_aligned:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: VTX_READ_16 T{{[0-9]+\.X, T[0-9]+\.X}}
|
|
|
|
; SI: buffer_load_ushort
|
2013-07-23 23:54:56 +00:00
|
|
|
define void @load_const_i16_aligned(i32 addrspace(1)* %out, i16 addrspace(2)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load i16, i16 addrspace(2)* %in
|
2013-07-23 23:54:56 +00:00
|
|
|
%1 = zext i16 %0 to i32
|
|
|
|
store i32 %1, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Load an un-aligned i16 value
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_const_i16_unaligned:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: VTX_READ_16 T{{[0-9]+\.X, T[0-9]+\.X}}
|
|
|
|
; SI: buffer_load_ushort
|
2013-07-23 23:54:56 +00:00
|
|
|
define void @load_const_i16_unaligned(i32 addrspace(1)* %out, i16 addrspace(2)* %in) {
|
|
|
|
entry:
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230786 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-27 19:29:02 +00:00
|
|
|
%0 = getelementptr i16, i16 addrspace(2)* %in, i32 1
|
2015-02-27 21:17:42 +00:00
|
|
|
%1 = load i16, i16 addrspace(2)* %0
|
2013-07-23 23:54:56 +00:00
|
|
|
%2 = zext i16 %1 to i32
|
|
|
|
store i32 %2, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Load an i32 value from the constant address space.
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_const_addrspace_i32:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: VTX_READ_32 T{{[0-9]+}}.X, T{{[0-9]+}}.X, 0
|
2013-07-23 23:54:56 +00:00
|
|
|
|
2015-02-03 21:53:27 +00:00
|
|
|
; SI: s_load_dword s{{[0-9]+}}
|
2013-07-23 23:54:56 +00:00
|
|
|
define void @load_const_addrspace_i32(i32 addrspace(1)* %out, i32 addrspace(2)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load i32, i32 addrspace(2)* %in
|
2013-07-23 23:54:56 +00:00
|
|
|
store i32 %0, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Load a f32 value from the constant address space.
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_const_addrspace_f32:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: VTX_READ_32 T{{[0-9]+}}.X, T{{[0-9]+}}.X, 0
|
2013-07-23 23:54:56 +00:00
|
|
|
|
2015-02-03 21:53:27 +00:00
|
|
|
; SI: s_load_dword s{{[0-9]+}}
|
2013-07-23 23:54:56 +00:00
|
|
|
define void @load_const_addrspace_f32(float addrspace(1)* %out, float addrspace(2)* %in) {
|
2015-02-27 21:17:42 +00:00
|
|
|
%1 = load float, float addrspace(2)* %in
|
2013-07-23 23:54:56 +00:00
|
|
|
store float %1, float addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-08-26 15:05:59 +00:00
|
|
|
;===------------------------------------------------------------------------===;
|
|
|
|
; LOCAL ADDRESS SPACE
|
|
|
|
;===------------------------------------------------------------------------===;
|
|
|
|
|
|
|
|
; Load an i8 value from the local address space.
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_i8_local:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: LDS_UBYTE_READ_RET
|
|
|
|
; SI-NOT: s_wqm_b64
|
|
|
|
; SI: s_mov_b32 m0
|
|
|
|
; SI: ds_read_u8
|
2013-08-26 15:05:59 +00:00
|
|
|
define void @load_i8_local(i32 addrspace(1)* %out, i8 addrspace(3)* %in) {
|
2015-02-27 21:17:42 +00:00
|
|
|
%1 = load i8, i8 addrspace(3)* %in
|
2013-08-26 15:05:59 +00:00
|
|
|
%2 = zext i8 %1 to i32
|
|
|
|
store i32 %2, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_i8_sext_local:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: LDS_UBYTE_READ_RET
|
2015-05-26 18:07:22 +00:00
|
|
|
; R600: BFE_INT
|
2015-02-03 21:53:27 +00:00
|
|
|
; SI-NOT: s_wqm_b64
|
|
|
|
; SI: s_mov_b32 m0
|
|
|
|
; SI: ds_read_i8
|
2013-08-26 15:05:59 +00:00
|
|
|
define void @load_i8_sext_local(i32 addrspace(1)* %out, i8 addrspace(3)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load i8, i8 addrspace(3)* %in
|
2013-08-26 15:05:59 +00:00
|
|
|
%1 = sext i8 %0 to i32
|
|
|
|
store i32 %1, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_v2i8_local:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: LDS_UBYTE_READ_RET
|
|
|
|
; R600: LDS_UBYTE_READ_RET
|
|
|
|
; SI-NOT: s_wqm_b64
|
|
|
|
; SI: s_mov_b32 m0
|
|
|
|
; SI: ds_read_u8
|
|
|
|
; SI: ds_read_u8
|
2013-08-26 15:06:10 +00:00
|
|
|
define void @load_v2i8_local(<2 x i32> addrspace(1)* %out, <2 x i8> addrspace(3)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load <2 x i8>, <2 x i8> addrspace(3)* %in
|
2013-08-26 15:06:10 +00:00
|
|
|
%1 = zext <2 x i8> %0 to <2 x i32>
|
|
|
|
store <2 x i32> %1, <2 x i32> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_v2i8_sext_local:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600-DAG: LDS_UBYTE_READ_RET
|
|
|
|
; R600-DAG: LDS_UBYTE_READ_RET
|
2015-05-26 18:07:22 +00:00
|
|
|
; R600-DAG: BFE_INT
|
|
|
|
; R600-DAG: BFE_INT
|
2015-02-03 21:53:27 +00:00
|
|
|
; SI-NOT: s_wqm_b64
|
|
|
|
; SI: s_mov_b32 m0
|
|
|
|
; SI: ds_read_i8
|
|
|
|
; SI: ds_read_i8
|
2013-08-26 15:06:10 +00:00
|
|
|
define void @load_v2i8_sext_local(<2 x i32> addrspace(1)* %out, <2 x i8> addrspace(3)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load <2 x i8>, <2 x i8> addrspace(3)* %in
|
2013-08-26 15:06:10 +00:00
|
|
|
%1 = sext <2 x i8> %0 to <2 x i32>
|
|
|
|
store <2 x i32> %1, <2 x i32> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_v4i8_local:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: LDS_UBYTE_READ_RET
|
|
|
|
; R600: LDS_UBYTE_READ_RET
|
|
|
|
; R600: LDS_UBYTE_READ_RET
|
|
|
|
; R600: LDS_UBYTE_READ_RET
|
|
|
|
; SI-NOT: s_wqm_b64
|
|
|
|
; SI: s_mov_b32 m0
|
|
|
|
; SI: ds_read_u8
|
|
|
|
; SI: ds_read_u8
|
|
|
|
; SI: ds_read_u8
|
|
|
|
; SI: ds_read_u8
|
2013-08-26 15:06:10 +00:00
|
|
|
define void @load_v4i8_local(<4 x i32> addrspace(1)* %out, <4 x i8> addrspace(3)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load <4 x i8>, <4 x i8> addrspace(3)* %in
|
2013-08-26 15:06:10 +00:00
|
|
|
%1 = zext <4 x i8> %0 to <4 x i32>
|
|
|
|
store <4 x i32> %1, <4 x i32> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_v4i8_sext_local:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600-DAG: LDS_UBYTE_READ_RET
|
|
|
|
; R600-DAG: LDS_UBYTE_READ_RET
|
|
|
|
; R600-DAG: LDS_UBYTE_READ_RET
|
|
|
|
; R600-DAG: LDS_UBYTE_READ_RET
|
2015-05-26 18:07:22 +00:00
|
|
|
; R600-DAG: BFE_INT
|
|
|
|
; R600-DAG: BFE_INT
|
|
|
|
; R600-DAG: BFE_INT
|
|
|
|
; R600-DAG: BFE_INT
|
2015-02-03 21:53:27 +00:00
|
|
|
; SI-NOT: s_wqm_b64
|
|
|
|
; SI: s_mov_b32 m0
|
|
|
|
; SI: ds_read_i8
|
|
|
|
; SI: ds_read_i8
|
|
|
|
; SI: ds_read_i8
|
|
|
|
; SI: ds_read_i8
|
2013-08-26 15:06:10 +00:00
|
|
|
define void @load_v4i8_sext_local(<4 x i32> addrspace(1)* %out, <4 x i8> addrspace(3)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load <4 x i8>, <4 x i8> addrspace(3)* %in
|
2013-08-26 15:06:10 +00:00
|
|
|
%1 = sext <4 x i8> %0 to <4 x i32>
|
|
|
|
store <4 x i32> %1, <4 x i32> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-08-26 15:05:59 +00:00
|
|
|
; Load an i16 value from the local address space.
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_i16_local:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: LDS_USHORT_READ_RET
|
|
|
|
; SI-NOT: s_wqm_b64
|
|
|
|
; SI: s_mov_b32 m0
|
|
|
|
; SI: ds_read_u16
|
2013-08-26 15:05:59 +00:00
|
|
|
define void @load_i16_local(i32 addrspace(1)* %out, i16 addrspace(3)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load i16 , i16 addrspace(3)* %in
|
2013-08-26 15:05:59 +00:00
|
|
|
%1 = zext i16 %0 to i32
|
|
|
|
store i32 %1, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_i16_sext_local:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: LDS_USHORT_READ_RET
|
2015-05-26 18:07:22 +00:00
|
|
|
; R600: BFE_INT
|
2015-02-03 21:53:27 +00:00
|
|
|
; SI-NOT: s_wqm_b64
|
|
|
|
; SI: s_mov_b32 m0
|
|
|
|
; SI: ds_read_i16
|
2013-08-26 15:05:59 +00:00
|
|
|
define void @load_i16_sext_local(i32 addrspace(1)* %out, i16 addrspace(3)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load i16, i16 addrspace(3)* %in
|
2013-08-26 15:05:59 +00:00
|
|
|
%1 = sext i16 %0 to i32
|
|
|
|
store i32 %1, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_v2i16_local:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: LDS_USHORT_READ_RET
|
|
|
|
; R600: LDS_USHORT_READ_RET
|
|
|
|
; SI-NOT: s_wqm_b64
|
|
|
|
; SI: s_mov_b32 m0
|
|
|
|
; SI: ds_read_u16
|
|
|
|
; SI: ds_read_u16
|
2013-08-26 15:06:10 +00:00
|
|
|
define void @load_v2i16_local(<2 x i32> addrspace(1)* %out, <2 x i16> addrspace(3)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load <2 x i16>, <2 x i16> addrspace(3)* %in
|
2013-08-26 15:06:10 +00:00
|
|
|
%1 = zext <2 x i16> %0 to <2 x i32>
|
|
|
|
store <2 x i32> %1, <2 x i32> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_v2i16_sext_local:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600-DAG: LDS_USHORT_READ_RET
|
|
|
|
; R600-DAG: LDS_USHORT_READ_RET
|
2015-05-26 18:07:22 +00:00
|
|
|
; R600-DAG: BFE_INT
|
|
|
|
; R600-DAG: BFE_INT
|
2015-02-03 21:53:27 +00:00
|
|
|
; SI-NOT: s_wqm_b64
|
|
|
|
; SI: s_mov_b32 m0
|
|
|
|
; SI: ds_read_i16
|
|
|
|
; SI: ds_read_i16
|
2013-08-26 15:06:10 +00:00
|
|
|
define void @load_v2i16_sext_local(<2 x i32> addrspace(1)* %out, <2 x i16> addrspace(3)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load <2 x i16>, <2 x i16> addrspace(3)* %in
|
2013-08-26 15:06:10 +00:00
|
|
|
%1 = sext <2 x i16> %0 to <2 x i32>
|
|
|
|
store <2 x i32> %1, <2 x i32> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_v4i16_local:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: LDS_USHORT_READ_RET
|
|
|
|
; R600: LDS_USHORT_READ_RET
|
|
|
|
; R600: LDS_USHORT_READ_RET
|
|
|
|
; R600: LDS_USHORT_READ_RET
|
|
|
|
; SI-NOT: s_wqm_b64
|
|
|
|
; SI: s_mov_b32 m0
|
|
|
|
; SI: ds_read_u16
|
|
|
|
; SI: ds_read_u16
|
|
|
|
; SI: ds_read_u16
|
|
|
|
; SI: ds_read_u16
|
2013-08-26 15:06:10 +00:00
|
|
|
define void @load_v4i16_local(<4 x i32> addrspace(1)* %out, <4 x i16> addrspace(3)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load <4 x i16>, <4 x i16> addrspace(3)* %in
|
2013-08-26 15:06:10 +00:00
|
|
|
%1 = zext <4 x i16> %0 to <4 x i32>
|
|
|
|
store <4 x i32> %1, <4 x i32> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_v4i16_sext_local:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600-DAG: LDS_USHORT_READ_RET
|
|
|
|
; R600-DAG: LDS_USHORT_READ_RET
|
|
|
|
; R600-DAG: LDS_USHORT_READ_RET
|
|
|
|
; R600-DAG: LDS_USHORT_READ_RET
|
2015-05-26 18:07:22 +00:00
|
|
|
; R600-DAG: BFE_INT
|
|
|
|
; R600-DAG: BFE_INT
|
|
|
|
; R600-DAG: BFE_INT
|
|
|
|
; R600-DAG: BFE_INT
|
2015-02-03 21:53:27 +00:00
|
|
|
; SI-NOT: s_wqm_b64
|
|
|
|
; SI: s_mov_b32 m0
|
|
|
|
; SI: ds_read_i16
|
|
|
|
; SI: ds_read_i16
|
|
|
|
; SI: ds_read_i16
|
|
|
|
; SI: ds_read_i16
|
2013-08-26 15:06:10 +00:00
|
|
|
define void @load_v4i16_sext_local(<4 x i32> addrspace(1)* %out, <4 x i16> addrspace(3)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load <4 x i16>, <4 x i16> addrspace(3)* %in
|
2013-08-26 15:06:10 +00:00
|
|
|
%1 = sext <4 x i16> %0 to <4 x i32>
|
|
|
|
store <4 x i32> %1, <4 x i32> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-02-10 16:58:30 +00:00
|
|
|
; load an i32 value from the local address space.
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_i32_local:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: LDS_READ_RET
|
|
|
|
; SI-NOT: s_wqm_b64
|
|
|
|
; SI: s_mov_b32 m0
|
|
|
|
; SI: ds_read_b32
|
2013-08-26 15:05:59 +00:00
|
|
|
define void @load_i32_local(i32 addrspace(1)* %out, i32 addrspace(3)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load i32, i32 addrspace(3)* %in
|
2013-08-26 15:05:59 +00:00
|
|
|
store i32 %0, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-02-10 16:58:30 +00:00
|
|
|
; load a f32 value from the local address space.
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_f32_local:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: LDS_READ_RET
|
|
|
|
; SI: s_mov_b32 m0
|
|
|
|
; SI: ds_read_b32
|
2013-08-26 15:05:59 +00:00
|
|
|
define void @load_f32_local(float addrspace(1)* %out, float addrspace(3)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load float, float addrspace(3)* %in
|
2013-08-26 15:05:59 +00:00
|
|
|
store float %0, float addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
2013-08-26 15:06:04 +00:00
|
|
|
|
|
|
|
; load a v2f32 value from the local address space
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}load_v2f32_local:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: LDS_READ_RET
|
|
|
|
; R600: LDS_READ_RET
|
|
|
|
; SI: s_mov_b32 m0
|
|
|
|
; SI: ds_read_b64
|
2013-08-26 15:06:04 +00:00
|
|
|
define void @load_v2f32_local(<2 x float> addrspace(1)* %out, <2 x float> addrspace(3)* %in) {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load <2 x float>, <2 x float> addrspace(3)* %in
|
2013-08-26 15:06:04 +00:00
|
|
|
store <2 x float> %0, <2 x float> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
2014-10-07 21:09:20 +00:00
|
|
|
|
|
|
|
; Test loading a i32 and v2i32 value from the same base pointer.
|
|
|
|
; FUNC-LABEL: {{^}}load_i32_v2i32_local:
|
2015-02-03 21:53:27 +00:00
|
|
|
; R600: LDS_READ_RET
|
|
|
|
; R600: LDS_READ_RET
|
|
|
|
; R600: LDS_READ_RET
|
|
|
|
; SI-DAG: ds_read_b32
|
|
|
|
; SI-DAG: ds_read2_b32
|
2014-10-07 21:09:20 +00:00
|
|
|
define void @load_i32_v2i32_local(<2 x i32> addrspace(1)* %out, i32 addrspace(3)* %in) {
|
2015-02-27 21:17:42 +00:00
|
|
|
%scalar = load i32, i32 addrspace(3)* %in
|
2014-10-07 21:09:20 +00:00
|
|
|
%tmp0 = bitcast i32 addrspace(3)* %in to <2 x i32> addrspace(3)*
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230786 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-27 19:29:02 +00:00
|
|
|
%vec_ptr = getelementptr <2 x i32>, <2 x i32> addrspace(3)* %tmp0, i32 2
|
2015-02-27 21:17:42 +00:00
|
|
|
%vec0 = load <2 x i32>, <2 x i32> addrspace(3)* %vec_ptr, align 4
|
2014-10-07 21:09:20 +00:00
|
|
|
%vec1 = insertelement <2 x i32> <i32 0, i32 0>, i32 %scalar, i32 0
|
|
|
|
%vec = add <2 x i32> %vec0, %vec1
|
|
|
|
store <2 x i32> %vec, <2 x i32> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
2014-10-15 21:08:59 +00:00
|
|
|
|
|
|
|
|
2014-11-13 19:56:13 +00:00
|
|
|
@lds = addrspace(3) global [512 x i32] undef, align 4
|
2014-10-15 21:08:59 +00:00
|
|
|
|
|
|
|
; On SI we need to make sure that the base offset is a register and not
|
|
|
|
; an immediate.
|
|
|
|
; FUNC-LABEL: {{^}}load_i32_local_const_ptr:
|
2015-02-03 21:53:27 +00:00
|
|
|
; SI: v_mov_b32_e32 v[[ZERO:[0-9]+]], 0
|
|
|
|
; SI: ds_read_b32 v0, v[[ZERO]] offset:4
|
|
|
|
; R600: LDS_READ_RET
|
2014-10-15 21:08:59 +00:00
|
|
|
define void @load_i32_local_const_ptr(i32 addrspace(1)* %out, i32 addrspace(3)* %in) {
|
|
|
|
entry:
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230786 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-27 19:29:02 +00:00
|
|
|
%tmp0 = getelementptr [512 x i32], [512 x i32] addrspace(3)* @lds, i32 0, i32 1
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load i32, i32 addrspace(3)* %tmp0
|
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230786 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-27 19:29:02 +00:00
|
|
|
%tmp2 = getelementptr i32, i32 addrspace(1)* %out, i32 1
|
2014-10-15 21:08:59 +00:00
|
|
|
store i32 %tmp1, i32 addrspace(1)* %tmp2
|
|
|
|
ret void
|
|
|
|
}
|