Files
RedBear-OS/local/recipes/dev/libclc/source/clang/test/CodeGenOpenCL/builtins-generic-amdgcn.cl
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

72 lines
2.5 KiB
Common Lisp

// REQUIRES: amdgpu-registered-target
// RUN: %clang_cc1 -Wno-error=int-conversion -triple amdgcn-unknown-unknown -emit-llvm -o - %s | FileCheck %s
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
// CHECK-LABEL: @test_builtin_clz(
// CHECK: tail call range(i32 0, 33) i32 @llvm.ctlz.i32(i32 %a, i1 true)
void test_builtin_clz(global int* out, int a)
{
*out = __builtin_clz(a);
}
// CHECK-LABEL: @test_builtin_clzl(
// CHECK: tail call range(i64 0, 65) i64 @llvm.ctlz.i64(i64 %a, i1 true)
void test_builtin_clzl(global long* out, long a)
{
*out = __builtin_clzl(a);
}
// CHECK: tail call ptr addrspace(5) @llvm.frameaddress.p5(i32 0)
void test_builtin_frame_address(int *out) {
*out = __builtin_frame_address(0);
}
// CHECK-LABEL: @test_builtin_ldexpf16(
// CHECK: tail call half @llvm.ldexp.f16.i32(half %v, i32 %e)
half test_builtin_ldexpf16(half v, int e) {
return __builtin_ldexpf16(v, e);
}
// CHECK-LABEL: @test_builtin_ldexpf(
// CHECK: tail call float @llvm.ldexp.f32.i32(float %v, i32 %e)
float test_builtin_ldexpf(float v, int e) {
return __builtin_ldexpf(v, e);
}
// CHECK-LABEL: @test_builtin_ldexp(
// CHECK: tail call double @llvm.ldexp.f64.i32(double %v, i32 %e)
double test_builtin_ldexp(double v, int e) {
return __builtin_ldexp(v, e);
}
// CHECK-LABEL: @test_builtin_frexpf16(
// CHECK: [[VAL:%.+]] = tail call { half, i32 } @llvm.frexp.f16.i32(half %v)
// CHECK: [[EXTRACT_1:%.+]] = extractvalue { half, i32 } [[VAL]], 1
// CHECK: store i32 [[EXTRACT_1]], ptr addrspace(5)
// CHECK: [[EXTRACT_0:%.+]] = extractvalue { half, i32 } [[VAL]], 0
// CHECK: ret half [[EXTRACT_0]]
half test_builtin_frexpf16(half v, int* e) {
return __builtin_frexpf16(v, e);
}
// CHECK-LABEL: @test_builtin_frexpf(
// CHECK: [[VAL:%.+]] = tail call { float, i32 } @llvm.frexp.f32.i32(float %v)
// CHECK: [[EXTRACT_1:%.+]] = extractvalue { float, i32 } [[VAL]], 1
// CHECK: store i32 [[EXTRACT_1]], ptr addrspace(5)
// CHECK: [[EXTRACT_0:%.+]] = extractvalue { float, i32 } [[VAL]], 0
// CHECK: ret float [[EXTRACT_0]]
float test_builtin_frexpf(float v, int* e) {
return __builtin_frexpf(v, e);
}
// CHECK-LABEL: @test_builtin_frexp(
// CHECK: [[VAL:%.+]] = tail call { double, i32 } @llvm.frexp.f64.i32(double %v)
// CHECK: [[EXTRACT_1:%.+]] = extractvalue { double, i32 } [[VAL]], 1
// CHECK: store i32 [[EXTRACT_1]], ptr addrspace(5)
// CHECK: [[EXTRACT_0:%.+]] = extractvalue { double, i32 } [[VAL]], 0
// CHECK: ret double [[EXTRACT_0]]
double test_builtin_frexp(double v, int* e) {
return __builtin_frexp(v, e);
}