mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
7c9c6ed761
Essentially the same as the GEP change in r230786. A similar migration script can be used to update test cases, though a few more test case improvements/changes were required this time around: (r229269-r229278) import fileinput import sys import re pat = re.compile(r"((?:=|:|^)\s*load (?:atomic )?(?:volatile )?(.*?))(| addrspace\(\d+\) *)\*($| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$)") for line in sys.stdin: sys.stdout.write(re.sub(pat, r"\1, \2\3*\4", line)) Reviewers: rafael, dexonsmith, grosser Differential Revision: http://reviews.llvm.org/D7649 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230794 91177308-0d34-0410-b5e6-96231b3b80d8
78 lines
2.9 KiB
LLVM
78 lines
2.9 KiB
LLVM
; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck --check-prefix=EG -check-prefix=FUNC %s
|
|
; RUN: llc -march=amdgcn -mcpu=verde -mattr=-promote-alloca -verify-machineinstrs < %s | FileCheck -check-prefix=SI-ALLOCA -check-prefix=SI -check-prefix=FUNC %s
|
|
; RUN: llc -march=amdgcn -mcpu=verde -mattr=+promote-alloca -verify-machineinstrs < %s | FileCheck -check-prefix=SI-PROMOTE -check-prefix=SI -check-prefix=FUNC %s
|
|
; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-promote-alloca -verify-machineinstrs < %s | FileCheck -check-prefix=SI-ALLOCA -check-prefix=SI -check-prefix=FUNC %s
|
|
; RUN: llc -march=amdgcn -mcpu=tonga -mattr=+promote-alloca -verify-machineinstrs < %s | FileCheck -check-prefix=SI-PROMOTE -check-prefix=SI -check-prefix=FUNC %s
|
|
|
|
; FUNC-LABEL: {{^}}vector_read:
|
|
; EG: MOV
|
|
; EG: MOV
|
|
; EG: MOV
|
|
; EG: MOV
|
|
; EG: MOVA_INT
|
|
define void @vector_read(i32 addrspace(1)* %out, i32 %index) {
|
|
entry:
|
|
%0 = alloca [4 x i32]
|
|
%x = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 0
|
|
%y = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 1
|
|
%z = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 2
|
|
%w = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 3
|
|
store i32 0, i32* %x
|
|
store i32 1, i32* %y
|
|
store i32 2, i32* %z
|
|
store i32 3, i32* %w
|
|
%1 = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 %index
|
|
%2 = load i32, i32* %1
|
|
store i32 %2, i32 addrspace(1)* %out
|
|
ret void
|
|
}
|
|
|
|
; FUNC-LABEL: {{^}}vector_write:
|
|
; EG: MOV
|
|
; EG: MOV
|
|
; EG: MOV
|
|
; EG: MOV
|
|
; EG: MOVA_INT
|
|
; EG: MOVA_INT
|
|
define void @vector_write(i32 addrspace(1)* %out, i32 %w_index, i32 %r_index) {
|
|
entry:
|
|
%0 = alloca [4 x i32]
|
|
%x = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 0
|
|
%y = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 1
|
|
%z = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 2
|
|
%w = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 3
|
|
store i32 0, i32* %x
|
|
store i32 0, i32* %y
|
|
store i32 0, i32* %z
|
|
store i32 0, i32* %w
|
|
%1 = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 %w_index
|
|
store i32 1, i32* %1
|
|
%2 = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 %r_index
|
|
%3 = load i32, i32* %2
|
|
store i32 %3, i32 addrspace(1)* %out
|
|
ret void
|
|
}
|
|
|
|
; This test should be optimize to:
|
|
; store i32 0, i32 addrspace(1)* %out
|
|
; FUNC-LABEL: {{^}}bitcast_gep:
|
|
; EG: STORE_RAW
|
|
define void @bitcast_gep(i32 addrspace(1)* %out, i32 %w_index, i32 %r_index) {
|
|
entry:
|
|
%0 = alloca [4 x i32]
|
|
%x = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 0
|
|
%y = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 1
|
|
%z = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 2
|
|
%w = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 3
|
|
store i32 0, i32* %x
|
|
store i32 0, i32* %y
|
|
store i32 0, i32* %z
|
|
store i32 0, i32* %w
|
|
%1 = getelementptr [4 x i32], [4 x i32]* %0, i32 0, i32 1
|
|
%2 = bitcast i32* %1 to [4 x i32]*
|
|
%3 = getelementptr [4 x i32], [4 x i32]* %2, i32 0, i32 0
|
|
%4 = load i32, i32* %3
|
|
store i32 %4, i32 addrspace(1)* %out
|
|
ret void
|
|
}
|