[LLVMdev] where can I find out the documents of how to write a llvm regression test case?

Changcheng Wang changcheng at multicorewareinc.com
Mon Aug 27 20:01:04 PDT 2012


hi,weiren:
i have reading the samples in  llvm-3.0.src/test/CodeGen/CBackend/.
and i have two questions,
1. int the file of 2008-02-01-UnalignedLoadStore.ll,have sentences as below:
; RUN: llc < %s -march=c | \
; RUN:          grep {struct __attribute__ ((packed, aligned(} | count 4

if " grep {struct __attribute__ ((packed, aligned(}" means to verify
the whole file(llc output) to find out the string of "struct
__attribute__ ((packed, aligned("?
what is the mean of "count 4"?

2.i write a test case with FileCheck like below,but fail:
 ; RUN: llc -march=c < %s | FileCheck %s

; ModuleID = 'hello.c'
target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str = private unnamed_addr constant [12 x i8] c"helloworld\0A\00", align 1

define i32 @main() nounwind uwtable {
entry:
  %retval = alloca i32, align 4
  store i32 0, i32* %retval
  %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([12
x i8]* @.str, i32 0, i32 0))
  ret i32 0
}

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

;CHECK: main
;CHECK: printf
;CHECK: {define}

i means to check the string of "define" in the file(llc output).i do
not know where is wrong,can you help me?

thanks,

changcheng


On Mon, Aug 27, 2012 at 5:37 PM, 陳韋任 (Wei-Ren Chen)
<chenwj at iis.sinica.edu.tw> wrote:
>> 2.i want to write such a test:translate a *.ll(i.e:hello.ll) file to a
>> *.c file(i.e:hello.c) with llc,then verify if the .c file contian a
>> certain string(i.e:"abc:). so:
>
>   It seems you want to test LLVM C backend, go looking for
> llvm-3.0.src/test/CodeGen/CBackend/* (C backend had been
> removed from LLVM 3.1).
>
> HTH,
> chenwj
>
> --
> Wei-Ren Chen (陳韋任)
> Computer Systems Lab, Institute of Information Science,
> Academia Sinica, Taiwan (R.O.C.)
> Tel:886-2-2788-3799 #1667
> Homepage: http://people.cs.nctu.edu.tw/~chenwj




More information about the llvm-dev mailing list