2017-11-07 01:04:37 +08:00
|
|
|
; RUN: llc -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=verde -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,SI,FUNC %s
|
|
|
|
; RUN: llc -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,VI,FUNC %s
|
|
|
|
; RUN: llc -amdgpu-scalarize-global-loads=false -march=r600 -mcpu=redwood < %s | FileCheck -check-prefixes=EG,FUNC %s
|
2013-05-10 10:09:34 +08:00
|
|
|
|
|
|
|
; mul24 and mad24 are affected
|
|
|
|
|
2014-10-02 01:15:17 +08:00
|
|
|
; FUNC-LABEL: {{^}}test_mul_v2i32:
|
2014-06-05 16:00:36 +08:00
|
|
|
; EG: MULLO_INT {{\*? *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
|
|
|
|
; EG: MULLO_INT {{\*? *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
|
2013-06-25 21:55:26 +08:00
|
|
|
|
2017-11-07 01:04:37 +08:00
|
|
|
; GCN: v_mul_lo_i32 v{{[0-9]+, v[0-9]+, v[0-9]+}}
|
|
|
|
; GCN: v_mul_lo_i32 v{{[0-9]+, v[0-9]+, v[0-9]+}}
|
2013-06-25 21:55:26 +08:00
|
|
|
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @test_mul_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-25 21:55:26 +08:00
|
|
|
%result = mul <2 x i32> %a, %b
|
|
|
|
store <2 x i32> %result, <2 x i32> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-02 01:15:17 +08:00
|
|
|
; FUNC-LABEL: {{^}}v_mul_v4i32:
|
2014-06-05 16:00:36 +08:00
|
|
|
; EG: MULLO_INT {{\*? *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
|
|
|
|
; EG: MULLO_INT {{\*? *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
|
|
|
|
; EG: MULLO_INT {{\*? *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
|
|
|
|
; EG: MULLO_INT {{\*? *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
|
2013-06-25 21:55:26 +08:00
|
|
|
|
2017-11-07 01:04:37 +08:00
|
|
|
; GCN: v_mul_lo_i32 v{{[0-9]+, v[0-9]+, v[0-9]+}}
|
|
|
|
; GCN: v_mul_lo_i32 v{{[0-9]+, v[0-9]+, v[0-9]+}}
|
|
|
|
; GCN: v_mul_lo_i32 v{{[0-9]+, v[0-9]+, v[0-9]+}}
|
|
|
|
; GCN: v_mul_lo_i32 v{{[0-9]+, v[0-9]+, v[0-9]+}}
|
2013-06-25 21:55:26 +08:00
|
|
|
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @v_mul_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
|
2013-05-10 10:09:34 +08:00
|
|
|
%result = mul <4 x i32> %a, %b
|
|
|
|
store <4 x i32> %result, <4 x i32> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
2014-03-28 01:23:31 +08:00
|
|
|
|
2014-10-02 01:15:17 +08:00
|
|
|
; FUNC-LABEL: {{^}}s_trunc_i64_mul_to_i32:
|
2017-11-07 01:04:37 +08:00
|
|
|
; GCN: s_load_dword
|
|
|
|
; GCN: s_load_dword
|
|
|
|
; GCN: s_mul_i32
|
|
|
|
; GCN: buffer_store_dword
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @s_trunc_i64_mul_to_i32(i32 addrspace(1)* %out, i64 %a, i64 %b) {
|
2014-09-04 07:24:35 +08:00
|
|
|
%mul = mul i64 %b, %a
|
|
|
|
%trunc = trunc i64 %mul to i32
|
|
|
|
store i32 %trunc, i32 addrspace(1)* %out, align 8
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-02 01:15:17 +08:00
|
|
|
; FUNC-LABEL: {{^}}v_trunc_i64_mul_to_i32:
|
2017-11-07 01:04:37 +08:00
|
|
|
; GCN: s_load_dword
|
|
|
|
; GCN: s_load_dword
|
|
|
|
; GCN: v_mul_lo_i32
|
|
|
|
; GCN: buffer_store_dword
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @v_trunc_i64_mul_to_i32(i32 addrspace(1)* %out, i64 addrspace(1)* %aptr, i64 addrspace(1)* %bptr) nounwind {
|
2015-02-28 05:17:42 +08:00
|
|
|
%a = load i64, i64 addrspace(1)* %aptr, align 8
|
|
|
|
%b = load i64, i64 addrspace(1)* %bptr, align 8
|
2014-03-28 01:23:31 +08:00
|
|
|
%mul = mul i64 %b, %a
|
|
|
|
%trunc = trunc i64 %mul to i32
|
|
|
|
store i32 %trunc, i32 addrspace(1)* %out, align 8
|
|
|
|
ret void
|
|
|
|
}
|
2014-04-12 00:12:01 +08:00
|
|
|
|
|
|
|
; This 64-bit multiply should just use MUL_HI and MUL_LO, since the top
|
|
|
|
; 32-bits of both arguments are sign bits.
|
2014-10-02 01:15:17 +08:00
|
|
|
; FUNC-LABEL: {{^}}mul64_sext_c:
|
2014-04-12 00:12:01 +08:00
|
|
|
; EG-DAG: MULLO_INT
|
|
|
|
; EG-DAG: MULHI_INT
|
2017-11-07 01:04:37 +08:00
|
|
|
; GCN-DAG: s_mul_i32
|
|
|
|
; GCN-DAG: v_mul_hi_i32
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @mul64_sext_c(i64 addrspace(1)* %out, i32 %in) {
|
2014-04-12 00:12:01 +08:00
|
|
|
entry:
|
|
|
|
%0 = sext i32 %in to i64
|
|
|
|
%1 = mul i64 %0, 80
|
|
|
|
store i64 %1, i64 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-02 01:15:17 +08:00
|
|
|
; FUNC-LABEL: {{^}}v_mul64_sext_c:
|
2014-09-04 07:24:35 +08:00
|
|
|
; EG-DAG: MULLO_INT
|
|
|
|
; EG-DAG: MULHI_INT
|
2017-11-07 01:04:37 +08:00
|
|
|
; GCN-DAG: v_mul_lo_i32
|
|
|
|
; GCN-DAG: v_mul_hi_i32
|
|
|
|
; GCN: s_endpgm
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @v_mul64_sext_c(i64 addrspace(1)* %out, i32 addrspace(1)* %in) {
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i32, i32 addrspace(1)* %in, align 4
|
2014-09-04 07:24:35 +08:00
|
|
|
%ext = sext i32 %val to i64
|
|
|
|
%mul = mul i64 %ext, 80
|
|
|
|
store i64 %mul, i64 addrspace(1)* %out, align 8
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-02 01:15:17 +08:00
|
|
|
; FUNC-LABEL: {{^}}v_mul64_sext_inline_imm:
|
2017-11-07 01:04:37 +08:00
|
|
|
; GCN-DAG: v_mul_lo_i32 v{{[0-9]+}}, v{{[0-9]+}}, 9
|
|
|
|
; GCN-DAG: v_mul_hi_i32 v{{[0-9]+}}, v{{[0-9]+}}, 9
|
|
|
|
; GCN: s_endpgm
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @v_mul64_sext_inline_imm(i64 addrspace(1)* %out, i32 addrspace(1)* %in) {
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load i32, i32 addrspace(1)* %in, align 4
|
2014-09-04 07:24:35 +08:00
|
|
|
%ext = sext i32 %val to i64
|
|
|
|
%mul = mul i64 %ext, 9
|
|
|
|
store i64 %mul, i64 addrspace(1)* %out, align 8
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-02 01:15:17 +08:00
|
|
|
; FUNC-LABEL: {{^}}s_mul_i32:
|
2017-11-07 01:04:37 +08:00
|
|
|
; GCN: s_load_dword [[SRC0:s[0-9]+]],
|
|
|
|
; GCN: s_load_dword [[SRC1:s[0-9]+]],
|
|
|
|
; GCN: s_mul_i32 [[SRESULT:s[0-9]+]], [[SRC0]], [[SRC1]]
|
|
|
|
; GCN: v_mov_b32_e32 [[VRESULT:v[0-9]+]], [[SRESULT]]
|
|
|
|
; GCN: buffer_store_dword [[VRESULT]],
|
|
|
|
; GCN: s_endpgm
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @s_mul_i32(i32 addrspace(1)* %out, i32 %a, i32 %b) nounwind {
|
2014-09-04 07:24:35 +08:00
|
|
|
%mul = mul i32 %a, %b
|
|
|
|
store i32 %mul, i32 addrspace(1)* %out, align 4
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-02 01:15:17 +08:00
|
|
|
; FUNC-LABEL: {{^}}v_mul_i32:
|
2017-11-07 01:04:37 +08:00
|
|
|
; GCN: v_mul_lo_i32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}}
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @v_mul_i32(i32 addrspace(1)* %out, 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 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
|
2014-09-04 07:24:35 +08:00
|
|
|
%result = mul i32 %a, %b
|
|
|
|
store i32 %result, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-04-12 00:12:01 +08:00
|
|
|
; A standard 64-bit multiply. The expansion should be around 6 instructions.
|
|
|
|
; It would be difficult to match the expansion correctly without writing
|
|
|
|
; a really complicated list of FileCheck expressions. I don't want
|
|
|
|
; to confuse people who may 'break' this test with a correct optimization,
|
|
|
|
; so this test just uses FUNC-LABEL to make sure the compiler does not
|
|
|
|
; crash with a 'failed to select' error.
|
2014-09-04 07:24:35 +08:00
|
|
|
|
2014-10-02 01:15:17 +08:00
|
|
|
; FUNC-LABEL: {{^}}s_mul_i64:
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @s_mul_i64(i64 addrspace(1)* %out, i64 %a, i64 %b) nounwind {
|
2014-09-04 07:24:35 +08:00
|
|
|
%mul = mul i64 %a, %b
|
|
|
|
store i64 %mul, i64 addrspace(1)* %out, align 8
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-02 01:15:17 +08:00
|
|
|
; FUNC-LABEL: {{^}}v_mul_i64:
|
2017-11-07 01:04:37 +08:00
|
|
|
; GCN: v_mul_lo_i32
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @v_mul_i64(i64 addrspace(1)* %out, i64 addrspace(1)* %aptr, i64 addrspace(1)* %bptr) {
|
2015-02-28 05:17:42 +08:00
|
|
|
%a = load i64, i64 addrspace(1)* %aptr, align 8
|
|
|
|
%b = load i64, i64 addrspace(1)* %bptr, align 8
|
2014-09-04 07:24:35 +08:00
|
|
|
%mul = mul i64 %a, %b
|
|
|
|
store i64 %mul, i64 addrspace(1)* %out, align 8
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-02 01:15:17 +08:00
|
|
|
; FUNC-LABEL: {{^}}mul32_in_branch:
|
2017-11-07 01:04:37 +08:00
|
|
|
; GCN: s_mul_i32
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @mul32_in_branch(i32 addrspace(1)* %out, i32 addrspace(1)* %in, i32 %a, i32 %b, i32 %c) {
|
2014-04-12 00:12:01 +08:00
|
|
|
entry:
|
2014-09-04 07:24:35 +08:00
|
|
|
%0 = icmp eq i32 %a, 0
|
|
|
|
br i1 %0, label %if, label %else
|
|
|
|
|
|
|
|
if:
|
2015-02-28 05:17:42 +08:00
|
|
|
%1 = load i32, i32 addrspace(1)* %in
|
2014-09-04 07:24:35 +08:00
|
|
|
br label %endif
|
|
|
|
|
|
|
|
else:
|
|
|
|
%2 = mul i32 %a, %b
|
|
|
|
br label %endif
|
|
|
|
|
|
|
|
endif:
|
|
|
|
%3 = phi i32 [%1, %if], [%2, %else]
|
|
|
|
store i32 %3, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-02 01:15:17 +08:00
|
|
|
; FUNC-LABEL: {{^}}mul64_in_branch:
|
2017-11-07 01:04:37 +08:00
|
|
|
; GCN-DAG: s_mul_i32
|
|
|
|
; GCN-DAG: v_mul_hi_u32
|
|
|
|
; GCN: s_endpgm
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @mul64_in_branch(i64 addrspace(1)* %out, i64 addrspace(1)* %in, i64 %a, i64 %b, i64 %c) {
|
2014-09-04 07:24:35 +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-09-04 07:24:35 +08:00
|
|
|
br label %endif
|
|
|
|
|
|
|
|
else:
|
|
|
|
%2 = mul i64 %a, %b
|
|
|
|
br label %endif
|
|
|
|
|
|
|
|
endif:
|
|
|
|
%3 = phi i64 [%1, %if], [%2, %else]
|
|
|
|
store i64 %3, i64 addrspace(1)* %out
|
2014-04-12 00:12:01 +08:00
|
|
|
ret void
|
|
|
|
}
|
2016-12-10 01:49:14 +08:00
|
|
|
|
|
|
|
; FIXME: Load dwordx4
|
|
|
|
; FUNC-LABEL: {{^}}s_mul_i128:
|
2017-11-07 01:04:37 +08:00
|
|
|
; GCN: s_load_dwordx2
|
|
|
|
; GCN: s_load_dwordx2
|
|
|
|
; GCN: s_load_dwordx2
|
|
|
|
; GCN: s_load_dwordx2
|
2016-12-10 01:49:14 +08:00
|
|
|
|
|
|
|
; SI: v_mul_hi_u32
|
|
|
|
; SI: v_mul_hi_u32
|
|
|
|
; SI: s_mul_i32
|
|
|
|
; SI: v_mul_hi_u32
|
|
|
|
; SI: s_mul_i32
|
2017-11-16 05:51:43 +08:00
|
|
|
; SI: s_mul_i32
|
2017-11-07 01:04:37 +08:00
|
|
|
|
2017-05-31 00:49:24 +08:00
|
|
|
; SI-DAG: s_mul_i32
|
|
|
|
; SI-DAG: v_mul_hi_u32
|
|
|
|
; SI-DAG: v_mul_hi_u32
|
|
|
|
; SI-DAG: s_mul_i32
|
2016-12-10 01:49:14 +08:00
|
|
|
; SI-DAG: s_mul_i32
|
|
|
|
; SI-DAG: v_mul_hi_u32
|
2017-11-07 01:04:37 +08:00
|
|
|
|
|
|
|
; VI: s_mul_i32
|
2018-03-31 00:19:13 +08:00
|
|
|
; VI: v_mul_hi_u32
|
2017-11-08 08:48:25 +08:00
|
|
|
; VI: s_mul_i32
|
|
|
|
; VI: v_mul_hi_u32
|
2017-11-07 01:04:37 +08:00
|
|
|
; VI: v_mad_u64_u32
|
2018-03-31 00:19:13 +08:00
|
|
|
; VI: v_mad_u64_u32
|
2017-11-07 01:04:37 +08:00
|
|
|
; VI: v_mad_u64_u32
|
|
|
|
|
|
|
|
|
2017-11-16 05:51:43 +08:00
|
|
|
|
2017-11-07 01:04:37 +08:00
|
|
|
; GCN: buffer_store_dwordx4
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @s_mul_i128(i128 addrspace(1)* %out, i128 %a, i128 %b) nounwind #0 {
|
2016-12-10 01:49:14 +08:00
|
|
|
%mul = mul i128 %a, %b
|
|
|
|
store i128 %mul, i128 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; FUNC-LABEL: {{^}}v_mul_i128:
|
2017-11-07 01:04:37 +08:00
|
|
|
; GCN: {{buffer|flat}}_load_dwordx4
|
|
|
|
; GCN: {{buffer|flat}}_load_dwordx4
|
|
|
|
|
2017-11-16 05:51:43 +08:00
|
|
|
; SI-DAG: v_mul_lo_i32
|
|
|
|
; SI-DAG: v_mul_hi_u32
|
|
|
|
; SI-DAG: v_mul_hi_u32
|
|
|
|
; SI-DAG: v_mul_lo_i32
|
|
|
|
; SI-DAG: v_mul_hi_u32
|
|
|
|
; SI-DAG: v_mul_hi_u32
|
|
|
|
; SI-DAG: v_mul_lo_i32
|
|
|
|
; SI-DAG: v_mul_lo_i32
|
|
|
|
; SI-DAG: v_add_i32_e32
|
2016-12-10 01:49:14 +08:00
|
|
|
|
2017-02-16 01:19:50 +08:00
|
|
|
; SI-DAG: v_mul_hi_u32
|
|
|
|
; SI-DAG: v_mul_lo_i32
|
|
|
|
; SI-DAG: v_mul_hi_u32
|
|
|
|
; SI-DAG: v_mul_lo_i32
|
|
|
|
; SI-DAG: v_mul_lo_i32
|
|
|
|
; SI-DAG: v_mul_lo_i32
|
|
|
|
; SI-DAG: v_mul_lo_i32
|
|
|
|
; SI-DAG: v_mul_lo_i32
|
2016-12-10 01:49:14 +08:00
|
|
|
|
2017-11-16 05:51:43 +08:00
|
|
|
; VI-DAG: v_mul_lo_i32
|
|
|
|
; VI-DAG: v_mul_hi_u32
|
|
|
|
; VI: v_mad_u64_u32
|
2017-11-07 01:04:37 +08:00
|
|
|
; VI: v_mad_u64_u32
|
|
|
|
; VI: v_mad_u64_u32
|
|
|
|
|
|
|
|
; GCN: {{buffer|flat}}_store_dwordx4
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @v_mul_i128(i128 addrspace(1)* %out, i128 addrspace(1)* %aptr, i128 addrspace(1)* %bptr) #0 {
|
2016-12-10 01:49:14 +08:00
|
|
|
%tid = call i32 @llvm.r600.read.tidig.x()
|
|
|
|
%gep.a = getelementptr inbounds i128, i128 addrspace(1)* %aptr, i32 %tid
|
|
|
|
%gep.b = getelementptr inbounds i128, i128 addrspace(1)* %bptr, i32 %tid
|
|
|
|
%gep.out = getelementptr inbounds i128, i128 addrspace(1)* %bptr, i32 %tid
|
|
|
|
%a = load i128, i128 addrspace(1)* %gep.a
|
|
|
|
%b = load i128, i128 addrspace(1)* %gep.b
|
|
|
|
%mul = mul i128 %a, %b
|
|
|
|
store i128 %mul, i128 addrspace(1)* %gep.out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
declare i32 @llvm.r600.read.tidig.x() #1
|
|
|
|
|
|
|
|
attributes #0 = { nounwind }
|
|
|
|
attributes #1 = { nounwind readnone}
|