mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-06 05:06:45 +00:00
fc49bd2447
in local register allocator. If a reg-reg copy has a phys reg input and a virt reg output, and this is the last use of the phys reg, assign the phys reg to the virt reg. If a reg-reg copy has a phys reg output and we need to reload its spilled input, reload it directly into the phys reg than passing it through another reg. Following 76208, there is sometimes no dependency between the def of a phys reg and its use; this creates a window where that phys reg can be used for spilling (this is true in linear scan also). This is bad and needs to be fixed a better way, although 76208 works too well in practice to be reverted. However, there should normally be no spilling within inline asm blocks. The patch here goes a long way towards making this actually be true. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91485 91177308-0d34-0410-b5e6-96231b3b80d8
31 lines
1.2 KiB
LLVM
31 lines
1.2 KiB
LLVM
; RUN: llc < %s | grep {subfc r3,r5,r4}
|
|
; RUN: llc < %s | grep {subfze r4,r2}
|
|
; RUN: llc < %s -regalloc=local | grep {subfc r5,r4,r3}
|
|
; RUN: llc < %s -regalloc=local | grep {subfze r2,r2}
|
|
; The first argument of subfc must not be the same as any other register.
|
|
|
|
; PR1357
|
|
|
|
target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
|
|
target triple = "powerpc-apple-darwin8.8.0"
|
|
|
|
;long long test(int A, int B, int C) {
|
|
; unsigned X, Y;
|
|
; __asm__ ("subf%I3c %1,%4,%3\n\tsubfze %0,%2"
|
|
; : "=r" (X), "=&r" (Y)
|
|
; : "r" (A), "rI" (B), "r" (C));
|
|
; return ((long long)Y << 32) | X;
|
|
;}
|
|
|
|
define i64 @test(i32 %A, i32 %B, i32 %C) nounwind {
|
|
entry:
|
|
%Y = alloca i32, align 4 ; <i32*> [#uses=2]
|
|
%tmp4 = call i32 asm "subf${3:I}c $1,$4,$3\0A\09subfze $0,$2", "=r,=*&r,r,rI,r"( i32* %Y, i32 %A, i32 %B, i32 %C ) ; <i32> [#uses=1]
|
|
%tmp5 = load i32* %Y ; <i32> [#uses=1]
|
|
%tmp56 = zext i32 %tmp5 to i64 ; <i64> [#uses=1]
|
|
%tmp7 = shl i64 %tmp56, 32 ; <i64> [#uses=1]
|
|
%tmp89 = zext i32 %tmp4 to i64 ; <i64> [#uses=1]
|
|
%tmp10 = or i64 %tmp7, %tmp89 ; <i64> [#uses=1]
|
|
ret i64 %tmp10
|
|
}
|