mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-21 18:29:46 +00:00
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
62 lines
2.1 KiB
LLVM
62 lines
2.1 KiB
LLVM
; RUN: llc -mtriple=thumbv6m-apple-none-macho -relocation-model=pic -o - %s | FileCheck %s --check-prefix=CHECK-THUMB-PIC
|
|
; RUN: llc -mtriple=arm-apple-none-macho -relocation-model=pic -o - %s | FileCheck %s --check-prefix=CHECK-ARM-PIC
|
|
; RUN: llc -mtriple=thumbv6m-apple-none-macho -relocation-model=dynamic-no-pic -o - %s | FileCheck %s --check-prefix=CHECK-DYNAMIC
|
|
; RUN: llc -mtriple=arm-apple-none-macho -relocation-model=dynamic-no-pic -o - %s | FileCheck %s --check-prefix=CHECK-DYNAMIC
|
|
; RUN: llc -mtriple=thumbv6m-apple-none-macho -relocation-model=static -o - %s | FileCheck %s --check-prefix=CHECK-STATIC
|
|
; RUN: llc -mtriple=arm-apple-none-macho -relocation-model=static -o - %s | FileCheck %s --check-prefix=CHECK-STATIC
|
|
@var = global [16 x i32] zeroinitializer
|
|
|
|
declare void @bar(i32*)
|
|
|
|
define void @foo() {
|
|
%flag = load i32, i32* getelementptr inbounds([16 x i32], [16 x i32]* @var, i32 0, i32 1)
|
|
%tst = icmp eq i32 %flag, 0
|
|
br i1 %tst, label %true, label %false
|
|
true:
|
|
tail call void @bar(i32* getelementptr inbounds([16 x i32], [16 x i32]* @var, i32 0, i32 4))
|
|
ret void
|
|
false:
|
|
ret void
|
|
}
|
|
|
|
; CHECK-THUMB-PIC-LABEL: foo:
|
|
; CHECK-THUMB-PIC: ldr r0, LCPI0_0
|
|
; CHECK-THUMB-PIC: LPC0_0:
|
|
; CHECK-THUMB-PIC-NEXT: add r0, pc
|
|
; CHECK-THUMB-PIC: ldr {{r[1-9][0-9]?}}, [r0, #4]
|
|
|
|
; CHECK-THUMB-PIC: LCPI0_0:
|
|
; CHECK-THUMB-PIC-NEXT: .long _var-(LPC0_0+4)
|
|
; CHECK-THUMB-PIC-NOT: LCPI0_1
|
|
|
|
|
|
; CHECK-ARM-PIC-LABEL: foo:
|
|
; CHECK-ARM-PIC: ldr [[VAR_OFFSET:r[0-9]+]], LCPI0_0
|
|
; CHECK-ARM-PIC: LPC0_0:
|
|
; CHECK-ARM-PIC-NEXT: add r0, pc, [[VAR_OFFSET]]
|
|
; CHECK-ARM-PIC: ldr {{r[0-9]+}}, [r0, #4]
|
|
|
|
; CHECK-ARM-PIC: LCPI0_0:
|
|
; CHECK-ARM-PIC-NEXT: .long _var-(LPC0_0+8)
|
|
; CHECK-ARM-PIC-NOT: LCPI0_1
|
|
|
|
|
|
; CHECK-DYNAMIC-LABEL: foo:
|
|
; CHECK-DYNAMIC: ldr r0, LCPI0_0
|
|
; CHECK-DYNAMIC: ldr {{r[1-9][0-9]?}}, [r0, #4]
|
|
|
|
; CHECK-DYNAMIC: LCPI0_0:
|
|
; CHECK-DYNAMIC-NEXT: .long _var
|
|
; CHECK-DYNAMIC-NOT: LCPI0_1
|
|
|
|
|
|
; CHECK-STATIC-LABEL: foo:
|
|
; CHECK-STATIC: ldr r0, LCPI0_0
|
|
; CHECK-STATIC: ldr {{r[1-9][0-9]?}}, [r0, #4]
|
|
|
|
; CHECK-STATIC: LCPI0_0:
|
|
; CHECK-STATIC-NEXT: .long _var{{$}}
|
|
; CHECK-STATIC-NOT: LCPI0_1
|
|
|
|
|