Re: [llvm-commits] test/C++Frontend/2008-02-13-sret.cpp

2008-02-15 Thread Duncan Sands
On Thursday 14 February 2008 19:02:26 Dale Johannesen wrote:
 
 On Feb 14, 2008, at 6:52 AM, Duncan Sands wrote:
 
  Hi Dale, this test is failing for me (x86-32 linux):
  there is nothing called retval.
 
  // RUN: %llvmgxx -S -O0 -emit-llvm %s -o - | grep retval | grep S242  
  | grep {i32 1} | count 2
 
 OK, that's because Linux returns S242 by the sret mechanism instead of  
 as an i64.  What's I'd like to do to preserve the sense of the test is  
 grep for retval | memtmp, but I'm not sure how to do that portably.   
 Does this work for you?
 
 // RUN: %llvmgxx -S -O0 -emit-llvm %s -o - | grep {retval\\|memtmp} |  
 grep S242 | grep {i32 1} | count 2

It works for me so I've committed it.

Thanks!

Duncan.
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] test/C++Frontend/2008-02-13-sret.cpp

2008-02-14 Thread Duncan Sands
Hi Dale, this test is failing for me (x86-32 linux):
there is nothing called retval.

// RUN: %llvmgxx -S -O0 -emit-llvm %s -o - | grep retval | grep S242 | grep 
{i32 1} | count 2

Ciao,

Duncan.

; ModuleID = '2008-02-13-sret.cpp'
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-f80:32:32
target triple = i686-pc-linux-gnu
%struct.S242 = type { i8*, [1 x i32] }
%struct.S92 = type { i16, [2 x i8] }
%struct.S93 = type { i8*, [1 x i32] }
@s242 = external global %struct.S242; %struct.S242* [#uses=2]
@s93 = external global %struct.S242 ; %struct.S242* [#uses=1]
@s92 = external global %struct.S92  ; %struct.S92* [#uses=1]

define void @_Z7check92v(%struct.S92* sret  %agg.result) {
entry:
%ret = alloca %struct.S92, align 4  ; %struct.S92* 
[#uses=0]
%memtmp = alloca %struct.S92, align 8   ; %struct.S92* 
[#uses=2]
%alloca point = bitcast i32 0 to i32  ; i32 [#uses=0]
%agg.result1 = bitcast %struct.S92* %agg.result to i8*  ; i8* 
[#uses=1]
%tmp = call i8* @_Z6memsetPvim( i8* %agg.result1, i32 0, i32 4 )
; i8* [#uses=0]
%tmp2 = getelementptr %struct.S92* @s92, i32 0, i32 0   ; 
i16* [#uses=1]
%tmp3 = load i16* %tmp2, align 1; i16 [#uses=1]
%tmp4 = shl i16 %tmp3, 2; i16 [#uses=1]
%tmp5 = ashr i16 %tmp4, 2   ; i16 [#uses=1]
%tmp6 = getelementptr %struct.S92* %agg.result, i32 0, i32 0
; i16* [#uses=2]
%tmp7 = load i16* %tmp6, align 1; i16 [#uses=1]
%tmp8 = and i16 %tmp5, 16383; i16 [#uses=1]
%tmp9 = and i16 %tmp7, -16384   ; i16 [#uses=1]
%tmp10 = or i16 %tmp9, %tmp8; i16 [#uses=1]
store i16 %tmp10, i16* %tmp6, align 1
%tmp11 = getelementptr %struct.S92* %memtmp, i32 0, i32 0   
; i16* [#uses=1]
%tmp12 = getelementptr %struct.S92* %agg.result, i32 0, i32 0   
; i16* [#uses=1]
%tmp13 = load i16* %tmp12, align 4  ; i16 [#uses=1]
store i16 %tmp13, i16* %tmp11, align 4
%tmp14 = getelementptr %struct.S92* %memtmp, i32 0, i32 1   
; [2 x i8]* [#uses=2]
%tmp15 = getelementptr %struct.S92* %agg.result, i32 0, i32 1   
; [2 x i8]* [#uses=2]
%tmp16 = getelementptr [2 x i8]* %tmp14, i32 0, i32 0   ; i8* 
[#uses=1]
%tmp17 = getelementptr [2 x i8]* %tmp15, i32 0, i32 0   ; i8* 
[#uses=1]
%tmp18 = load i8* %tmp17, align 2   ; i8 [#uses=1]
store i8 %tmp18, i8* %tmp16, align 2
%tmp19 = getelementptr [2 x i8]* %tmp14, i32 0, i32 1   ; i8* 
[#uses=1]
%tmp20 = getelementptr [2 x i8]* %tmp15, i32 0, i32 1   ; i8* 
[#uses=1]
%tmp21 = load i8* %tmp20, align 1   ; i8 [#uses=1]
store i8 %tmp21, i8* %tmp19, align 1
br label %return

return: ; preds = %entry
ret void
}

define void @_Z10check242vaiz(i32 %z, ...) {
entry:
%z_addr = alloca i32; i32* [#uses=1]
%ap = alloca i8*; i8** [#uses=4]
%arg = alloca %struct.S242  ; %struct.S242* [#uses=2]
%tmp = alloca %struct.S242  ; %struct.S242* [#uses=4]
%ap.2 = alloca i8*  ; i8** [#uses=3]
%alloca point = bitcast i32 0 to i32  ; i32 [#uses=0]
store i32 %z, i32* %z_addr
%ap1 = bitcast i8** %ap to i8*  ; i8* [#uses=1]
call void @llvm.va_start( i8* %ap1 )
%tmp2 = load i8** %ap, align 4  ; i8* [#uses=1]
store i8* %tmp2, i8** %ap.2, align 4
%tmp3 = load i8** %ap.2, align 4; i8* [#uses=1]
%tmp4 = getelementptr i8* %tmp3, i64 8  ; i8* [#uses=1]
store i8* %tmp4, i8** %ap, align 4
%tmp5 = load i8** %ap.2, align 4; i8* [#uses=1]
%tmp56 = bitcast i8* %tmp5 to %struct.S242* ; 
%struct.S242* [#uses=2]
%tmp7 = getelementptr %struct.S242* %tmp, i32 0, i32 0  ; 
i8** [#uses=1]
%tmp8 = getelementptr %struct.S242* %tmp56, i32 0, i32 0
; i8** [#uses=1]
%tmp9 = load i8** %tmp8, align 4; i8* [#uses=1]
store i8* %tmp9, i8** %tmp7, align 4
%tmp10 = getelementptr %struct.S242* %tmp, i32 0, i32 1 ; [1 x 
i32]* [#uses=1]
%tmp11 = getelementptr %struct.S242* %tmp56, i32 0, i32 1   
; [1 x i32]* [#uses=1]
%tmp12 = getelementptr [1 x i32]* %tmp10, i32 0, i32 0  ; 
i32* [#uses=1]
%tmp13 = getelementptr [1 x i32]* %tmp11, i32 0, i32 0  ; 
i32* [#uses=1]
%tmp14 = load i32* %tmp13, align 4  ; i32 [#uses=1]
store i32 %tmp14, i32* %tmp12, align 4
 

Re: [llvm-commits] test/C++Frontend/2008-02-13-sret.cpp

2008-02-14 Thread Dale Johannesen

On Feb 14, 2008, at 6:52 AM, Duncan Sands wrote:

 Hi Dale, this test is failing for me (x86-32 linux):
 there is nothing called retval.

 // RUN: %llvmgxx -S -O0 -emit-llvm %s -o - | grep retval | grep S242  
 | grep {i32 1} | count 2

OK, that's because Linux returns S242 by the sret mechanism instead of  
as an i64.  What's I'd like to do to preserve the sense of the test is  
grep for retval | memtmp, but I'm not sure how to do that portably.   
Does this work for you?

// RUN: %llvmgxx -S -O0 -emit-llvm %s -o - | grep {retval\\|memtmp} |  
grep S242 | grep {i32 1} | count 2

___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits