- define void @sub1(i32* %p, i32 %v) {
- entry:
- ; CHECK: sub1:
- ; CHECK: subl
- %0 = tail call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %p, i32 %v)
- ret void
- }
-
- define void @inc4(i64* %p) {
- entry:
- ; CHECK: inc4:
- ; CHECK: incq
- %0 = tail call i64 @llvm.atomic.load.add.i64.p0i64(i64* %p, i64 1)
- ret void
- }
-
-Here you can see some "CHECK:" lines specified in comments. Now you can
-see how the file is piped into llvm-as, then llc, and the machine code
-output is what we are verifying. FileCheck checks the machine code
-output to verify that it matches what the "CHECK:" lines specify.
-
-The syntax of the CHECK: lines is very simple: they are fixed strings
-that must occur in order. FileCheck defaults to ignoring horizontal
-whitespace differences (e.g. a space is allowed to match a tab) but
-otherwise, the contents of the CHECK: line is required to match some
-thing in the test file exactly.
-
-One nice thing about FileCheck (compared to grep) is that it allows
-merging test cases together into logical groups. For example, because
-the test above is checking for the "sub1:" and "inc4:" labels, it will
-not match unless there is a "subl" in between those labels. If it
-existed somewhere else in the file, that would not count: "grep subl"
-matches if subl exists anywhere in the file.
-
-The FileCheck -check-prefix option
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-The FileCheck -check-prefix option allows multiple test configurations
-to be driven from one .ll file. This is useful in many circumstances,
-for example, testing different architectural variants with llc. Here's a
-simple example: