mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-17 18:31:04 +00:00
5a70dd1d82
Similar to gep (r230786) and load (r230794) changes. Similar migration script can be used to update test cases, which successfully migrated all of LLVM and Polly, but about 4 test cases needed manually changes in Clang. (this script will read the contents of stdin and massage it into stdout - wrap it in the 'apply.sh' script shown in previous commits + xargs to apply it over a large set of test cases) import fileinput import sys import re rep = re.compile(r"(getelementptr(?:\s+inbounds)?\s*\()((<\d*\s+x\s+)?([^@]*?)(|\s*addrspace\(\d+\))\s*\*(?(3)>)\s*)(?=$|%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|zeroinitializer|<|\[\[[a-zA-Z]|\{\{)", re.MULTILINE | re.DOTALL) def conv(match): line = match.group(1) line += match.group(4) line += ", " line += match.group(2) return line line = sys.stdin.read() off = 0 for match in re.finditer(rep, line): sys.stdout.write(line[off:match.start()]) sys.stdout.write(conv(match)) off = match.end() sys.stdout.write(line[off:]) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232184 91177308-0d34-0410-b5e6-96231b3b80d8
95 lines
3.3 KiB
LLVM
95 lines
3.3 KiB
LLVM
; RUN: llc < %s -march=x86 -mtriple=i386-linux-gnu -mcpu=penryn -mattr=sse4.1 | FileCheck %s --check-prefix=X32
|
|
; RUN: llc < %s -mtriple=x86_64-linux -mcpu=penryn -mattr=sse4.1 | FileCheck %s --check-prefix=X64
|
|
; RUN: llc < %s -mtriple=x86_64-win32 -mcpu=penryn -mattr=sse4.1 | FileCheck %s --check-prefix=X64
|
|
|
|
define i32 @test1() nounwind readonly {
|
|
; X32-LABEL: test1:
|
|
; X32: # BB#0: # %entry
|
|
; X32-NEXT: movl %gs:196, %eax
|
|
; X32-NEXT: movl (%eax), %eax
|
|
; X32-NEXT: retl
|
|
;
|
|
; X64-LABEL: test1:
|
|
; X64: # BB#0: # %entry
|
|
; X64-NEXT: movq %gs:320, %rax
|
|
; X64-NEXT: movl (%rax), %eax
|
|
; X64-NEXT: retq
|
|
entry:
|
|
%tmp = load i32*, i32* addrspace(256)* getelementptr (i32*, i32* addrspace(256)* inttoptr (i32 72 to i32* addrspace(256)*), i32 31) ; <i32*> [#uses=1]
|
|
%tmp1 = load i32, i32* %tmp ; <i32> [#uses=1]
|
|
ret i32 %tmp1
|
|
}
|
|
|
|
define i64 @test2(void (i8*)* addrspace(256)* %tmp8) nounwind {
|
|
; X32-LABEL: test2:
|
|
; X32: # BB#0: # %entry
|
|
; X32-NEXT: subl $12, %esp
|
|
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
; X32-NEXT: calll *%gs:(%eax)
|
|
; X32-NEXT: xorl %eax, %eax
|
|
; X32-NEXT: xorl %edx, %edx
|
|
; X32-NEXT: addl $12, %esp
|
|
; X32-NEXT: retl
|
|
;
|
|
; X64-LABEL: test2:
|
|
; X64: # BB#0: # %entry
|
|
; X64-NEXT: {{(subq.*%rsp|pushq)}}
|
|
; X64-NEXT: callq *%gs:(%{{(rcx|rdi)}})
|
|
; X64-NEXT: xorl %eax, %eax
|
|
; X64-NEXT: {{(addq.*%rsp|popq)}}
|
|
; X64-NEXT: retq
|
|
entry:
|
|
%tmp9 = load void (i8*)*, void (i8*)* addrspace(256)* %tmp8, align 8
|
|
tail call void %tmp9(i8* undef) nounwind optsize
|
|
ret i64 0
|
|
}
|
|
|
|
define <2 x i64> @pmovsxwd_1(i64 addrspace(256)* %p) nounwind readonly {
|
|
; X32-LABEL: pmovsxwd_1:
|
|
; X32: # BB#0: # %entry
|
|
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
; X32-NEXT: pmovsxwd %gs:(%eax), %xmm0
|
|
; X32-NEXT: retl
|
|
;
|
|
; X64-LABEL: pmovsxwd_1:
|
|
; X64: # BB#0: # %entry
|
|
; X64-NEXT: pmovsxwd %gs:(%{{(rcx|rdi)}}), %xmm0
|
|
; X64-NEXT: retq
|
|
entry:
|
|
%0 = load i64, i64 addrspace(256)* %p
|
|
%tmp2 = insertelement <2 x i64> zeroinitializer, i64 %0, i32 0
|
|
%1 = bitcast <2 x i64> %tmp2 to <8 x i16>
|
|
%2 = tail call <4 x i32> @llvm.x86.sse41.pmovsxwd(<8 x i16> %1) nounwind readnone
|
|
%3 = bitcast <4 x i32> %2 to <2 x i64>
|
|
ret <2 x i64> %3
|
|
}
|
|
|
|
; The two loads here both look identical to selection DAG, except for their
|
|
; address spaces. Make sure they aren't CSE'd.
|
|
define i32 @test_no_cse() nounwind readonly {
|
|
; X32-LABEL: test_no_cse:
|
|
; X32: # BB#0: # %entry
|
|
; X32-NEXT: movl %gs:196, %eax
|
|
; X32-NEXT: movl (%eax), %eax
|
|
; X32-NEXT: movl %fs:196, %ecx
|
|
; X32-NEXT: addl (%ecx), %eax
|
|
; X32-NEXT: retl
|
|
;
|
|
; X64-LABEL: test_no_cse:
|
|
; X64: # BB#0: # %entry
|
|
; X64-NEXT: movq %gs:320, %rax
|
|
; X64-NEXT: movl (%rax), %eax
|
|
; X64-NEXT: movq %fs:320, %rcx
|
|
; X64-NEXT: addl (%rcx), %eax
|
|
; X64-NEXT: retq
|
|
entry:
|
|
%tmp = load i32*, i32* addrspace(256)* getelementptr (i32*, i32* addrspace(256)* inttoptr (i32 72 to i32* addrspace(256)*), i32 31) ; <i32*> [#uses=1]
|
|
%tmp1 = load i32, i32* %tmp ; <i32> [#uses=1]
|
|
%tmp2 = load i32*, i32* addrspace(257)* getelementptr (i32*, i32* addrspace(257)* inttoptr (i32 72 to i32* addrspace(257)*), i32 31) ; <i32*> [#uses=1]
|
|
%tmp3 = load i32, i32* %tmp2 ; <i32> [#uses=1]
|
|
%tmp4 = add i32 %tmp1, %tmp3
|
|
ret i32 %tmp4
|
|
}
|
|
|
|
declare <4 x i32> @llvm.x86.sse41.pmovsxwd(<8 x i16>) nounwind readnone
|