mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-27 13:30:05 +00:00
e1af5f6ad1
Utilizing the 8 and 16 bit comparison instructions, even when an input can be folded into the comparison instruction itself, is typically not worth it. There are too many partial register stalls as a result, leading to significant slowdowns. By always performing comparisons on at least 32-bit registers, performance of the calculation chain leading to the comparison improves. Continue to use the smaller comparisons when minimizing size, as that allows better folding of loads into the comparison instructions. rdar://15386341 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195496 91177308-0d34-0410-b5e6-96231b3b80d8
92 lines
1.9 KiB
LLVM
92 lines
1.9 KiB
LLVM
; RUN: llc < %s -march=x86-64 | FileCheck %s
|
|
|
|
declare void @bar()
|
|
|
|
define void @test1(i32* nocapture %X) nounwind minsize {
|
|
entry:
|
|
%tmp1 = load i32* %X, align 4
|
|
%and = and i32 %tmp1, 255
|
|
%cmp = icmp eq i32 %and, 47
|
|
br i1 %cmp, label %if.then, label %if.end
|
|
|
|
if.then:
|
|
tail call void @bar() nounwind
|
|
br label %if.end
|
|
|
|
if.end:
|
|
ret void
|
|
; CHECK-LABEL: test1:
|
|
; CHECK: cmpb $47, (%{{rdi|rcx}})
|
|
}
|
|
|
|
define void @test2(i32 %X) nounwind minsize {
|
|
entry:
|
|
%and = and i32 %X, 255
|
|
%cmp = icmp eq i32 %and, 47
|
|
br i1 %cmp, label %if.then, label %if.end
|
|
|
|
if.then:
|
|
tail call void @bar() nounwind
|
|
br label %if.end
|
|
|
|
if.end:
|
|
ret void
|
|
; CHECK-LABEL: test2:
|
|
; CHECK: cmpb $47, %{{dil|cl}}
|
|
}
|
|
|
|
define void @test3(i32 %X) nounwind minsize {
|
|
entry:
|
|
%and = and i32 %X, 255
|
|
%cmp = icmp eq i32 %and, 255
|
|
br i1 %cmp, label %if.then, label %if.end
|
|
|
|
if.then:
|
|
tail call void @bar() nounwind
|
|
br label %if.end
|
|
|
|
if.end:
|
|
ret void
|
|
; CHECK-LABEL: test3:
|
|
; CHECK: cmpb $-1, %{{dil|cl}}
|
|
}
|
|
|
|
; PR16083
|
|
define i1 @test4(i64 %a, i32 %b) {
|
|
entry:
|
|
%tobool = icmp ne i32 %b, 0
|
|
br i1 %tobool, label %lor.end, label %lor.rhs
|
|
|
|
lor.rhs: ; preds = %entry
|
|
%and = and i64 0, %a
|
|
%tobool1 = icmp ne i64 %and, 0
|
|
br label %lor.end
|
|
|
|
lor.end: ; preds = %lor.rhs, %entry
|
|
%p = phi i1 [ true, %entry ], [ %tobool1, %lor.rhs ]
|
|
ret i1 %p
|
|
}
|
|
|
|
@x = global { i8, i8, i8, i8, i8, i8, i8, i8 } { i8 1, i8 0, i8 0, i8 0, i8 1, i8 0, i8 0, i8 1 }, align 4
|
|
|
|
; PR16551
|
|
define void @test5(i32 %X) nounwind minsize {
|
|
entry:
|
|
%bf.load = load i56* bitcast ({ i8, i8, i8, i8, i8, i8, i8, i8 }* @x to i56*), align 4
|
|
%bf.lshr = lshr i56 %bf.load, 32
|
|
%bf.cast = trunc i56 %bf.lshr to i32
|
|
%cmp = icmp ne i32 %bf.cast, 1
|
|
br i1 %cmp, label %if.then, label %if.end
|
|
|
|
if.then:
|
|
tail call void @bar() nounwind
|
|
br label %if.end
|
|
|
|
if.end:
|
|
ret void
|
|
|
|
; CHECK-LABEL: test5:
|
|
; CHECK-NOT: cmpl $1,{{.*}}x+4
|
|
; CHECK: ret
|
|
}
|