[llvm-commits] [PATCH]: set CR1EQ on PPC32 only when seeing floating var arg

Roman Divacky rdivacky at freebsd.org
Wed Aug 24 12:14:34 PDT 2011


Hi,

PPC32 formal arguments lowering is slightly broken, it sets CR1EQ bit
when the call is a vararg one. It should set the bit only with vararg
call that has floating point arguments in registers and unset the
bit otherwise. The attached patch fixes that + test.

This is normally just an optimization but it's very important in the
kernel where doing floating point stuff is lethal.

OK to commit?

thank you, roman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ppc-cr1eq.patch
Type: text/x-diff
Size: 1888 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110824/62e1e4e8/attachment.patch>
-------------- next part --------------
; RUN: llc < %s | FileCheck %s
; ModuleID = 'test.c'
target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v128:128:128-n32"
target triple = "powerpc-unknown-freebsd"

@.str = private unnamed_addr constant [4 x i8] c"%i\0A\00", align 1
@.str1 = private unnamed_addr constant [4 x i8] c"%f\0A\00", align 1

define void @foo() nounwind {
entry:
; CHECK: crxor 6, 6, 6
  %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i32 1)
; CHECK: creqv 6, 6, 6
  %call1 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str1, i32 0, i32 0), double 1.100000e+00)
  ret void
}

declare i32 @printf(i8*, ...)


More information about the llvm-commits mailing list