2017-12-01 06:51:26 +08:00
|
|
|
; RUN: llc -march=amdgcn -mcpu=verde -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,SIVI,FUNC %s
|
|
|
|
; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,SIVI,FUNC %s
|
|
|
|
; RUN: llc -march=amdgcn -mcpu=gfx900 -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GFX9,FUNC %s
|
2016-05-06 04:07:37 +08:00
|
|
|
; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2017-12-01 06:51:26 +08:00
|
|
|
; FUNC-LABEL: {{^}}s_add_i32:
|
|
|
|
; EG: ADD_INT {{[* ]*}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
|
2013-10-12 05:03:41 +08:00
|
|
|
|
2017-12-01 06:51:26 +08:00
|
|
|
; GCN: s_add_i32 s[[REG:[0-9]+]], {{s[0-9]+, s[0-9]+}}
|
|
|
|
; GCN: v_mov_b32_e32 v[[REG]], s[[REG]]
|
|
|
|
; GCN: buffer_store_dword v[[REG]],
|
|
|
|
define amdgpu_kernel void @s_add_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in) #0 {
|
[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
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%b_ptr = getelementptr i32, i32 addrspace(1)* %in, i32 1
|
2015-02-28 05:17:42 +08:00
|
|
|
%a = load i32, i32 addrspace(1)* %in
|
|
|
|
%b = load i32, i32 addrspace(1)* %b_ptr
|
2013-10-12 05:03:41 +08:00
|
|
|
%result = add i32 %a, %b
|
|
|
|
store i32 %result, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-12-01 06:51:26 +08:00
|
|
|
; FUNC-LABEL: {{^}}s_add_v2i32:
|
|
|
|
; EG: ADD_INT {{[* ]*}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
|
|
|
|
; EG: ADD_INT {{[* ]*}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2017-12-01 06:51:26 +08:00
|
|
|
; GCN: s_add_i32 s{{[0-9]+, s[0-9]+, s[0-9]+}}
|
|
|
|
; GCN: s_add_i32 s{{[0-9]+, s[0-9]+, s[0-9]+}}
|
|
|
|
define amdgpu_kernel void @s_add_v2i32(<2 x i32> addrspace(1)* %out, <2 x i32> addrspace(1)* %in) {
|
[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
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%b_ptr = getelementptr <2 x i32>, <2 x i32> addrspace(1)* %in, i32 1
|
2015-02-28 05:17:42 +08:00
|
|
|
%a = load <2 x i32>, <2 x i32> addrspace(1)* %in
|
|
|
|
%b = load <2 x i32>, <2 x i32> addrspace(1)* %b_ptr
|
2013-06-21 05:55:30 +08:00
|
|
|
%result = add <2 x i32> %a, %b
|
|
|
|
store <2 x i32> %result, <2 x i32> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-12-01 06:51:26 +08:00
|
|
|
; FUNC-LABEL: {{^}}s_add_v4i32:
|
|
|
|
; EG: ADD_INT {{[* ]*}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
|
|
|
|
; EG: ADD_INT {{[* ]*}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
|
|
|
|
; EG: ADD_INT {{[* ]*}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
|
|
|
|
; EG: ADD_INT {{[* ]*}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
|
|
|
|
|
|
|
|
; GCN: s_add_i32 s{{[0-9]+, s[0-9]+, s[0-9]+}}
|
|
|
|
; GCN: s_add_i32 s{{[0-9]+, s[0-9]+, s[0-9]+}}
|
|
|
|
; GCN: s_add_i32 s{{[0-9]+, s[0-9]+, s[0-9]+}}
|
|
|
|
; GCN: s_add_i32 s{{[0-9]+, s[0-9]+, s[0-9]+}}
|
|
|
|
define amdgpu_kernel void @s_add_v4i32(<4 x i32> addrspace(1)* %out, <4 x i32> addrspace(1)* %in) {
|
[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
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
|
|
|
%b_ptr = getelementptr <4 x i32>, <4 x i32> addrspace(1)* %in, i32 1
|
2015-02-28 05:17:42 +08:00
|
|
|
%a = load <4 x i32>, <4 x i32> addrspace(1)* %in
|
|
|
|
%b = load <4 x i32>, <4 x i32> addrspace(1)* %b_ptr
|
2012-12-12 05:25:42 +08:00
|
|
|
%result = add <4 x i32> %a, %b
|
|
|
|
store <4 x i32> %result, <4 x i32> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
2014-02-14 07:34:15 +08:00
|
|
|
|
2017-12-01 06:51:26 +08:00
|
|
|
; FUNC-LABEL: {{^}}s_add_v8i32:
|
2015-02-04 05:53:27 +08:00
|
|
|
; EG: ADD_INT
|
|
|
|
; EG: ADD_INT
|
|
|
|
; EG: ADD_INT
|
|
|
|
; EG: ADD_INT
|
|
|
|
; EG: ADD_INT
|
|
|
|
; EG: ADD_INT
|
|
|
|
; EG: ADD_INT
|
|
|
|
; EG: ADD_INT
|
2015-05-01 01:15:56 +08:00
|
|
|
|
2017-12-01 06:51:26 +08:00
|
|
|
; GCN: s_add_i32
|
|
|
|
; GCN: s_add_i32
|
|
|
|
; GCN: s_add_i32
|
|
|
|
; GCN: s_add_i32
|
|
|
|
; GCN: s_add_i32
|
|
|
|
; GCN: s_add_i32
|
|
|
|
; GCN: s_add_i32
|
|
|
|
; GCN: s_add_i32
|
|
|
|
define amdgpu_kernel void @s_add_v8i32(<8 x i32> addrspace(1)* %out, <8 x i32> %a, <8 x i32> %b) {
|
2014-02-14 07:34:15 +08:00
|
|
|
entry:
|
|
|
|
%0 = add <8 x i32> %a, %b
|
|
|
|
store <8 x i32> %0, <8 x i32> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
2014-02-26 05:36:18 +08:00
|
|
|
|
2017-12-01 06:51:26 +08:00
|
|
|
; FUNC-LABEL: {{^}}s_add_v16i32:
|
2015-02-04 05:53:27 +08:00
|
|
|
; EG: ADD_INT
|
|
|
|
; EG: ADD_INT
|
|
|
|
; EG: ADD_INT
|
|
|
|
; EG: ADD_INT
|
|
|
|
; EG: ADD_INT
|
|
|
|
; EG: ADD_INT
|
|
|
|
; EG: ADD_INT
|
|
|
|
; EG: ADD_INT
|
|
|
|
; EG: ADD_INT
|
|
|
|
; EG: ADD_INT
|
|
|
|
; EG: ADD_INT
|
|
|
|
; EG: ADD_INT
|
|
|
|
; EG: ADD_INT
|
|
|
|
; EG: ADD_INT
|
|
|
|
; EG: ADD_INT
|
|
|
|
; EG: ADD_INT
|
2015-05-01 01:15:56 +08:00
|
|
|
|
2017-12-01 06:51:26 +08:00
|
|
|
; GCN: s_add_i32
|
|
|
|
; GCN: s_add_i32
|
|
|
|
; GCN: s_add_i32
|
|
|
|
; GCN: s_add_i32
|
|
|
|
; GCN: s_add_i32
|
|
|
|
; GCN: s_add_i32
|
|
|
|
; GCN: s_add_i32
|
|
|
|
; GCN: s_add_i32
|
|
|
|
; GCN: s_add_i32
|
|
|
|
; GCN: s_add_i32
|
|
|
|
; GCN: s_add_i32
|
|
|
|
; GCN: s_add_i32
|
|
|
|
; GCN: s_add_i32
|
|
|
|
; GCN: s_add_i32
|
|
|
|
; GCN: s_add_i32
|
|
|
|
; GCN: s_add_i32
|
|
|
|
define amdgpu_kernel void @s_add_v16i32(<16 x i32> addrspace(1)* %out, <16 x i32> %a, <16 x i32> %b) {
|
2014-03-01 05:36:37 +08:00
|
|
|
entry:
|
|
|
|
%0 = add <16 x i32> %a, %b
|
|
|
|
store <16 x i32> %0, <16 x i32> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-12-01 06:51:26 +08:00
|
|
|
; FUNC-LABEL: {{^}}v_add_i32:
|
|
|
|
; GCN: {{buffer|flat|global}}_load_dword [[A:v[0-9]+]]
|
|
|
|
; GCN: {{buffer|flat|global}}_load_dword [[B:v[0-9]+]]
|
|
|
|
; SIVI: v_add_{{i|u}}32_e32 v{{[0-9]+}}, vcc, [[B]], [[A]]
|
|
|
|
; GFX9: v_add_u32_e32 v{{[0-9]+}}, [[A]], [[B]]
|
|
|
|
define amdgpu_kernel void @v_add_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in) #0 {
|
|
|
|
%tid = call i32 @llvm.r600.read.tidig.x()
|
|
|
|
%gep = getelementptr inbounds i32, i32 addrspace(1)* %in, i32 %tid
|
|
|
|
%b_ptr = getelementptr i32, i32 addrspace(1)* %gep, i32 1
|
|
|
|
%a = load volatile i32, i32 addrspace(1)* %gep
|
|
|
|
%b = load volatile i32, i32 addrspace(1)* %b_ptr
|
|
|
|
%result = add i32 %a, %b
|
|
|
|
store i32 %result, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; FUNC-LABEL: {{^}}v_add_imm_i32:
|
|
|
|
; GCN: {{buffer|flat|global}}_load_dword [[A:v[0-9]+]]
|
|
|
|
; SIVI: v_add_{{i|u}}32_e32 v{{[0-9]+}}, vcc, 0x7b, [[A]]
|
|
|
|
; GFX9: v_add_u32_e32 v{{[0-9]+}}, 0x7b, [[A]]
|
|
|
|
define amdgpu_kernel void @v_add_imm_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in) #0 {
|
|
|
|
%tid = call i32 @llvm.r600.read.tidig.x()
|
|
|
|
%gep = getelementptr inbounds i32, i32 addrspace(1)* %in, i32 %tid
|
|
|
|
%b_ptr = getelementptr i32, i32 addrspace(1)* %gep, i32 1
|
|
|
|
%a = load volatile i32, i32 addrspace(1)* %gep
|
|
|
|
%result = add i32 %a, 123
|
|
|
|
store i32 %result, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-02 01:15:17 +08:00
|
|
|
; FUNC-LABEL: {{^}}add64:
|
2017-12-01 06:51:26 +08:00
|
|
|
; GCN: s_add_u32
|
|
|
|
; GCN: s_addc_u32
|
2015-05-01 01:15:56 +08:00
|
|
|
|
2016-07-02 06:47:50 +08:00
|
|
|
; EG: MEM_RAT_CACHELESS STORE_RAW [[LO:T[0-9]+\.XY]]
|
|
|
|
; EG-DAG: ADD_INT {{[* ]*}}
|
2015-05-01 01:15:56 +08:00
|
|
|
; EG-DAG: ADDC_UINT
|
|
|
|
; EG-DAG: ADD_INT
|
2016-07-02 06:47:50 +08:00
|
|
|
; EG-DAG: ADD_INT {{[* ]*}}
|
2015-05-01 01:15:56 +08:00
|
|
|
; EG-NOT: SUB
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @add64(i64 addrspace(1)* %out, i64 %a, i64 %b) {
|
2014-02-26 05:36:18 +08:00
|
|
|
entry:
|
2017-12-01 06:51:26 +08:00
|
|
|
%add = add i64 %a, %b
|
|
|
|
store i64 %add, i64 addrspace(1)* %out
|
2014-02-26 05:36:18 +08:00
|
|
|
ret void
|
|
|
|
}
|
2014-03-08 04:12:39 +08:00
|
|
|
|
2014-11-05 22:50:53 +08:00
|
|
|
; The v_addc_u32 and v_add_i32 instruction can't read SGPRs, because they
|
2014-03-08 04:12:39 +08:00
|
|
|
; use VCC. The test is designed so that %a will be stored in an SGPR and
|
|
|
|
; %0 will be stored in a VGPR, so the comiler will be forced to copy %a
|
|
|
|
; to a VGPR before doing the add.
|
|
|
|
|
2014-10-02 01:15:17 +08:00
|
|
|
; FUNC-LABEL: {{^}}add64_sgpr_vgpr:
|
2017-12-01 06:51:26 +08:00
|
|
|
; GCN-NOT: v_addc_u32_e32 s
|
2015-05-01 01:15:56 +08:00
|
|
|
|
2016-07-02 06:47:50 +08:00
|
|
|
; EG: MEM_RAT_CACHELESS STORE_RAW [[LO:T[0-9]+\.XY]]
|
|
|
|
; EG-DAG: ADD_INT {{[* ]*}}
|
2015-05-01 01:15:56 +08:00
|
|
|
; EG-DAG: ADDC_UINT
|
|
|
|
; EG-DAG: ADD_INT
|
2016-07-02 06:47:50 +08:00
|
|
|
; EG-DAG: ADD_INT {{[* ]*}}
|
2015-05-01 01:15:56 +08:00
|
|
|
; EG-NOT: SUB
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @add64_sgpr_vgpr(i64 addrspace(1)* %out, i64 %a, i64 addrspace(1)* %in) {
|
2014-03-08 04:12:39 +08:00
|
|
|
entry:
|
2015-02-28 05:17:42 +08:00
|
|
|
%0 = load i64, i64 addrspace(1)* %in
|
2014-03-08 04:12:39 +08:00
|
|
|
%1 = add i64 %a, %0
|
|
|
|
store i64 %1, i64 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
2014-05-15 22:41:54 +08:00
|
|
|
|
2014-09-24 09:33:28 +08:00
|
|
|
; Test i64 add inside a branch.
|
2014-10-02 01:15:17 +08:00
|
|
|
; FUNC-LABEL: {{^}}add64_in_branch:
|
2017-12-01 06:51:26 +08:00
|
|
|
; GCN: s_add_u32
|
|
|
|
; GCN: s_addc_u32
|
2015-05-01 01:15:56 +08:00
|
|
|
|
2016-07-02 06:47:50 +08:00
|
|
|
; EG: MEM_RAT_CACHELESS STORE_RAW [[LO:T[0-9]+\.XY]]
|
|
|
|
; EG-DAG: ADD_INT {{[* ]*}}
|
2015-05-01 01:15:56 +08:00
|
|
|
; EG-DAG: ADDC_UINT
|
|
|
|
; EG-DAG: ADD_INT
|
2016-07-02 06:47:50 +08:00
|
|
|
; EG-DAG: ADD_INT {{[* ]*}}
|
2015-05-01 01:15:56 +08:00
|
|
|
; EG-NOT: SUB
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @add64_in_branch(i64 addrspace(1)* %out, i64 addrspace(1)* %in, i64 %a, i64 %b, i64 %c) {
|
2014-05-15 22:41:54 +08:00
|
|
|
entry:
|
|
|
|
%0 = icmp eq i64 %a, 0
|
|
|
|
br i1 %0, label %if, label %else
|
|
|
|
|
|
|
|
if:
|
2015-02-28 05:17:42 +08:00
|
|
|
%1 = load i64, i64 addrspace(1)* %in
|
2014-05-15 22:41:54 +08:00
|
|
|
br label %endif
|
|
|
|
|
|
|
|
else:
|
|
|
|
%2 = add i64 %a, %b
|
|
|
|
br label %endif
|
|
|
|
|
|
|
|
endif:
|
|
|
|
%3 = phi i64 [%1, %if], [%2, %else]
|
|
|
|
store i64 %3, i64 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
2017-12-01 06:51:26 +08:00
|
|
|
|
|
|
|
declare i32 @llvm.r600.read.tidig.x() #1
|
|
|
|
|
|
|
|
attributes #0 = { nounwind }
|
|
|
|
attributes #1 = { nounwind readnone speculatable }
|