mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-09-01 04:29:57 +00:00
define double @foo(double %x, double %y, i1 %c) nounwind { %a = fdiv double %x, 3.2 %z = select i1 %c, double %a, double %y ret double %z } Was: _foo: divsd LCPI0_0(%rip), %xmm0 testb $1, %dil jne LBB0_2 movaps %xmm1, %xmm0 LBB0_2: ret Now: _foo: testb $1, %dil je LBB0_2 divsd LCPI0_0(%rip), %xmm0 ret LBB0_2: movaps %xmm1, %xmm0 ret This avoids the divsd when early exit is taken. rdar://8454886 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114372 91177308-0d34-0410-b5e6-96231b3b80d8
22 lines
918 B
LLVM
22 lines
918 B
LLVM
; RUN: llc < %s -march=mips -relocation-model=static | FileCheck %s
|
|
; Fix PR7473
|
|
|
|
define i32 @main() nounwind readnone {
|
|
entry:
|
|
%a = alloca i32, align 4 ; <i32*> [#uses=2]
|
|
%c = alloca i32, align 4 ; <i32*> [#uses=2]
|
|
volatile store i32 1, i32* %a, align 4
|
|
volatile store i32 0, i32* %c, align 4
|
|
%0 = volatile load i32* %a, align 4 ; <i32> [#uses=1]
|
|
%1 = icmp eq i32 %0, 0 ; <i1> [#uses=1]
|
|
; CHECK: addiu $3, $zero, 0
|
|
%iftmp.0.0 = select i1 %1, i32 3, i32 0 ; <i32> [#uses=1]
|
|
%2 = volatile load i32* %c, align 4 ; <i32> [#uses=1]
|
|
%3 = icmp eq i32 %2, 0 ; <i1> [#uses=1]
|
|
; CHECK: addiu $3, $zero, 3
|
|
; CHECK: addu $2, $5, $3
|
|
%iftmp.2.0 = select i1 %3, i32 0, i32 5 ; <i32> [#uses=1]
|
|
%4 = add nsw i32 %iftmp.2.0, %iftmp.0.0 ; <i32> [#uses=1]
|
|
ret i32 %4
|
|
}
|