Files
RedBear-OS/local/recipes/dev/libclc/source/clang/test/CodeGen/inline-asm-x86-flag-output.c
T
vasilito cb424d7448 build: static patch-sanity linter (shift-left the malformed-patch class)
verify-patch-sanity.py validates every active recipe .patch has internally-
consistent hunk line counts — catching the 'malformed patch at line N' failure
at commit/CI/preflight time instead of hours into a cook. This cycle hit that
class three times (qtwaylandscanner, sddm, xwayland), each only discovered when
cookbook tried to apply the patch.

Running it across the repo found 29 latent malformed patches (validated against
GNU patch: e.g. relibc/P3-sysv-ipc reproduces 'malformed patch at line 22').
They were harmless only because they sit in vendored recipes (baked, not re-
applied) — but would fail on any version-bump re-derivation. --fix recounts the
hunk headers (body untouched) and repaired all 29.

Wired into build-preflight.sh (Phase 1.0D) and redbear-ci.yml, with a unit test
(test-patch-sanity.sh). Skips archived/legacy trees and unvalidatable formats
(empty placeholders, bare-@@ git hunks).
2026-08-01 05:13:02 +03:00

396 lines
11 KiB
C

// RUN: %clang_cc1 -O2 -emit-llvm %s -o - -triple x86_64-unknown-linux-gnu | FileCheck %s
int test_cca(long nr, volatile long *addr) {
//CHECK-LABEL: @test_cca
//CHECK: = tail call i32 asm "cmp $2,$1", "={@cca},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@cca"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_ccae(long nr, volatile long *addr) {
//CHECK-LABEL: @test_ccae
//CHECK: = tail call i32 asm "cmp $2,$1", "={@ccae},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@ccae"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_ccb(long nr, volatile long *addr) {
//CHECK-LABEL: @test_ccb
//CHECK: = tail call i32 asm "cmp $2,$1", "={@ccb},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@ccb"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_ccbe(long nr, volatile long *addr) {
//CHECK-LABEL: @test_ccbe
//CHECK: tail call i32 asm "cmp $2,$1", "={@ccbe},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@ccbe"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_ccc(long nr, volatile long *addr) {
//CHECK-LABEL: @test_ccc
//CHECK: = tail call i32 asm "cmp $2,$1", "={@ccc},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@ccc"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_cce(long nr, volatile long *addr) {
//CHECK-LABEL: @test_cce
//CHECK: = tail call i32 asm "cmp $2,$1", "={@cce},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@cce"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_ccz(long nr, volatile long *addr) {
//CHECK-LABEL: @test_ccz
//CHECK: = tail call i32 asm "cmp $2,$1", "={@ccz},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@ccz"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_ccg(long nr, volatile long *addr) {
//CHECK-LABEL: @test_ccg
//CHECK: = tail call i32 asm "cmp $2,$1", "={@ccg},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@ccg"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_ccge(long nr, volatile long *addr) {
//CHECK-LABEL: @test_ccge
//CHECK: = tail call i32 asm "cmp $2,$1", "={@ccge},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@ccge"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_ccl(long nr, volatile long *addr) {
//CHECK-LABEL: @test_ccl
//CHECK: = tail call i32 asm "cmp $2,$1", "={@ccl},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@ccl"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_ccle(long nr, volatile long *addr) {
//CHECK-LABEL: @test_ccle
//CHECK: = tail call i32 asm "cmp $2,$1", "={@ccle},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@ccle"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_ccna(long nr, volatile long *addr) {
//CHECK-LABEL: @test_ccna
//CHECK: = tail call i32 asm "cmp $2,$1", "={@ccna},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@ccna"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_ccnae(long nr, volatile long *addr) {
//CHECK-LABEL: @test_ccnae
//CHECK: = tail call i32 asm "cmp $2,$1", "={@ccnae},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@ccnae"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_ccnb(long nr, volatile long *addr) {
//CHECK-LABEL: @test_ccnb
//CHECK: = tail call i32 asm "cmp $2,$1", "={@ccnb},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@ccnb"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_ccnbe(long nr, volatile long *addr) {
//CHECK-LABEL: @test_ccnbe
//CHECK: = tail call i32 asm "cmp $2,$1", "={@ccnbe},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@ccnbe"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_ccnc(long nr, volatile long *addr) {
//CHECK-LABEL: @test_ccnc
//CHECK: = tail call i32 asm "cmp $2,$1", "={@ccnc},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@ccnc"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_ccne(long nr, volatile long *addr) {
//CHECK-LABEL: @test_ccne
//CHECK: = tail call i32 asm "cmp $2,$1", "={@ccne},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@ccne"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_ccnz(long nr, volatile long *addr) {
//CHECK-LABEL: @test_ccnz
//CHECK: = tail call i32 asm "cmp $2,$1", "={@ccnz},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@ccnz"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_ccng(long nr, volatile long *addr) {
//CHECK-LABEL: @test_ccng
//CHECK: = tail call i32 asm "cmp $2,$1", "={@ccng},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@ccng"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_ccnge(long nr, volatile long *addr) {
//CHECK-LABEL: @test_ccnge
//CHECK: = tail call i32 asm "cmp $2,$1", "={@ccnge},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@ccnge"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_ccnl(long nr, volatile long *addr) {
//CHECK-LABEL: @test_ccnl
//CHECK: = tail call i32 asm "cmp $2,$1", "={@ccnl},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@ccnl"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_ccnle(long nr, volatile long *addr) {
//CHECK-LABEL: @test_ccnle
//CHECK: = tail call i32 asm "cmp $2,$1", "={@ccnle},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@ccnle"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_ccno(long nr, volatile long *addr) {
//CHECK-LABEL: @test_ccno
//CHECK: = tail call i32 asm "cmp $2,$1", "={@ccno},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@ccno"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_ccnp(long nr, volatile long *addr) {
//CHECK-LABEL: @test_ccnp
//CHECK: = tail call i32 asm "cmp $2,$1", "={@ccnp},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@ccnp"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_ccns(long nr, volatile long *addr) {
//CHECK-LABEL: @test_ccns
//CHECK: = tail call i32 asm "cmp $2,$1", "={@ccns},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@ccns"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_cco(long nr, volatile long *addr) {
//CHECK-LABEL: @test_cco
//CHECK: = tail call i32 asm "cmp $2,$1", "={@cco},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@cco"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_ccp(long nr, volatile long *addr) {
//CHECK-LABEL: @test_ccp
//CHECK: = tail call i32 asm "cmp $2,$1", "={@ccp},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@ccp"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
int test_ccs(long nr, volatile long *addr) {
//CHECK-LABEL: @test_ccs
//CHECK: = tail call i32 asm "cmp $2,$1", "={@ccs},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
int x;
asm("cmp %2,%1"
: "=@ccs"(x), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}
_Bool check_no_clobber_conflicts(void) {
//CHECK-LABEL: @check_no_clobber_conflicts
//CHECK: = tail call i8 asm "", "={@cce},~{cx},~{dirflag},~{fpsr},~{flags}"()
_Bool b;
asm(""
: "=@cce"(b)
:
: "cx");
return b;
}
int test_assume_boolean_flag(long nr, volatile long *addr) {
//CHECK-LABEL: @test_assume_boolean_flag
//CHECK: %0 = tail call { i32, i32 } asm "cmp $2,$1", "={@cca},={@ccae},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
//CHECK: [[RES1:%.*]] = extractvalue { i32, i32 } %0, 0
//CHECK: [[RES2:%.*]] = extractvalue { i32, i32 } %0, 1
//CHECK: %1 = icmp ult i32 [[RES1]], 2
//CHECK: tail call void @llvm.assume(i1 %1)
//CHECK: %2 = icmp ult i32 [[RES2]], 2
//CHECK: tail call void @llvm.assume(i1 %2)
int x,y;
asm("cmp %2,%1"
: "=@cca"(x), "=@ccae"(y), "=m"(*(volatile long *)(addr))
: "r"(nr)
: "cc");
if (x)
return 0;
return 1;
}