X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FTestingGuide.html;h=43c414d4c974ef877cabcca5e699fbb5a42fe9ec;hb=a1bbb78c36e61eca64febe81a09580c7356f74d7;hp=990dcee2079d98d2aea4fa98a8b4fe69182b5469;hpb=5dafafdeb4d89b37c6b7efbeabaa7d818c7023fe;p=oota-llvm.git diff --git a/docs/TestingGuide.html b/docs/TestingGuide.html index 990dcee2079..43c414d4c97 100644 --- a/docs/TestingGuide.html +++ b/docs/TestingGuide.html @@ -568,10 +568,12 @@ example, something like this works as you'd expect:

-define void @t2(<2 x double>* %r, <2 x double>* %A, double %B) nounwind  {
+define void @t2(<2 x double>* %r, <2 x double>* %A, double %B) {
 	%tmp3 = load <2 x double>* %A, align 16
 	%tmp7 = insertelement <2 x double> undef, double %B, i32 0
-	%tmp9 = shufflevector <2 x double> %tmp3, <2 x double> %tmp7, <2 x i32> < i32 0, i32 2 >
+	%tmp9 = shufflevector <2 x double> %tmp3,
+                              <2 x double> %tmp7,
+                              <2 x i32> < i32 0, i32 2 >
 	store <2 x double> %tmp9, <2 x double>* %r, align 16
 	ret void
         
@@ -590,6 +592,109 @@ define void @t2(<2 x double>* %r, <2 x double>* %A, double %B) nounw
 between it an the previous directive.  A CHECK-NEXT cannot be the first
 directive in a file.

+
+ + +
The "CHECK-NOT:" directive
+ +
+ +

The CHECK-NOT: directive is used to verify that a string doesn't occur +between two matches (or the first match and the beginning of the file). For +example, to verify that a load is removed by a transformation, a test like this +can be used:

+ +
+
+define i8 @coerce_offset0(i32 %V, i32* %P) {
+  store i32 %V, i32* %P
+   
+  %P2 = bitcast i32* %P to i8*
+  %P3 = getelementptr i8* %P2, i32 2
+
+  %A = load i8* %P3
+  ret i8 %A
+; CHECK: @coerce_offset0
+; CHECK-NOT: load
+; CHECK: ret i8
+}
+
+
+ +
+ + +
FileCheck Pattern Matching Syntax
+ +
+ +

The CHECK: and CHECK-NOT: directives both take a pattern to match. For most +uses of FileCheck, fixed string matching is perfectly sufficient. For some +things, a more flexible form of matching is desired. To support this, FileCheck +allows you to specify regular expressions in matching strings, surrounded by +double braces: {{yourregex}}. Because we want to use fixed string +matching for a majority of what we do, FileCheck has been designed to support +mixing and matching fixed string matching with regular expressions. This allows +you to write things like this:

+ +
+
+; CHECK: movhpd	{{[0-9]+}}(%esp), {{%xmm[0-7]}}
+
+
+ +

In this case, any offset from the ESP register will be allowed, and any xmm +register will be allowed.

+ +

Because regular expressions are enclosed with double braces, they are +visually distinct, and you don't need to use escape characters within the double +braces like you would in C. In the rare case that you want to match double +braces explicitly from the input, you can use something ugly like +{{[{][{]}} as your pattern.

+ +
+ + +
FileCheck Variables
+ +
+ +

It is often useful to match a pattern and then verify that it occurs again +later in the file. For codegen tests, this can be useful to allow any register, +but verify that that register is used consistently later. To do this, FileCheck +allows named variables to be defined and substituted into patterns. Here is a +simple example:

+ +
+
+; CHECK: test5:
+; CHECK:    notw	[[REGISTER:%[a-z]+]]
+; CHECK:    andw	{{.*}}[[REGISTER]]
+
+
+ +

The first check line matches a regex (%[a-z]+) and captures it into +the variables "REGISTER". The second line verifies that whatever is in REGISTER +occurs later in the file after an "andw". FileCheck variable references are +always contained in [[ ]] pairs, are named, and their names can be +formed with the regex "[a-zA-Z][a-zA-Z0-9]*". If a colon follows the +name, then it is a definition of the variable, if not, it is a use.

+ +

FileCheck variables can be defined multiple times, and uses always get the +latest value. Note that variables are all read at the start of a "CHECK" line +and are all defined at the end. This means that if you have something like +"CHECK: [[XYZ:.*]]x[[XYZ]]" that the check line will read the previous +value of the XYZ variable and define a new one after the match is performed. If +you need to do something like this you can probably take advantage of the fact +that FileCheck is not actually line-oriented when it matches, this allows you to +define two separate CHECK lines that match on the same line. +

+ + +
@@ -648,14 +753,6 @@ substitutions
The target triplet that corresponds to the current host machine (the one running the test cases). This should probably be called "host".
-
prcontext (%prcontext)
-
Path to the prcontext tcl script that prints some context around a - line that matches a pattern. This isn't strictly necessary as the test suite - is run with its PATH altered to include the test/Scripts directory where - the prcontext script is located. Note that this script is similar to - grep -C but you should use the prcontext script because - not all platforms support grep -C.
-
llvmgcc (%llvmgcc)
The full path to the llvm-gcc executable as specified in the configured LLVM environment