Skip to content

[CIR][CIRGen][NFC] Consolidate RUN lines for builtin tests #968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/test/CIR/CodeGen/builtin-assume.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-cir %s -o %t.cir
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir
// RUN: FileCheck %s --check-prefix=CIR --input-file=%t.cir

int test_assume(int x) {
Expand Down
140 changes: 70 additions & 70 deletions clang/test/CIR/CodeGen/builtin-bits.cpp
Original file line number Diff line number Diff line change
@@ -1,186 +1,186 @@
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++17 -fclangir -emit-cir %s -o %t.cir
// RUN: FileCheck --input-file=%t.cir %s
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir
// RUN: FileCheck %s --check-prefix=CIR --input-file=%t.cir

int test_builtin_clrsb(int x) {
return __builtin_clrsb(x);
}

// CHECK: cir.func @_Z18test_builtin_clrsbi
// CHECK: %{{.+}} = cir.bit.clrsb(%{{.+}} : !s32i) : !s32i
// CHECK: }
// CIR: cir.func @_Z18test_builtin_clrsbi
// CIR: %{{.+}} = cir.bit.clrsb(%{{.+}} : !s32i) : !s32i
// CIR: }

int test_builtin_clrsbl(long x) {
return __builtin_clrsbl(x);
}

// CHECK: cir.func @_Z19test_builtin_clrsbll
// CHECK: %{{.+}} = cir.bit.clrsb(%{{.+}} : !s64i) : !s32i
// CHECK: }
// CIR: cir.func @_Z19test_builtin_clrsbll
// CIR: %{{.+}} = cir.bit.clrsb(%{{.+}} : !s64i) : !s32i
// CIR: }

int test_builtin_clrsbll(long long x) {
return __builtin_clrsbll(x);
}

// CHECK: cir.func @_Z20test_builtin_clrsbllx
// CHECK: %{{.+}} = cir.bit.clrsb(%{{.+}} : !s64i) : !s32i
// CHECK: }
// CIR: cir.func @_Z20test_builtin_clrsbllx
// CIR: %{{.+}} = cir.bit.clrsb(%{{.+}} : !s64i) : !s32i
// CIR: }

int test_builtin_ctzs(unsigned short x) {
return __builtin_ctzs(x);
}

// CHECK: cir.func @_Z17test_builtin_ctzst
// CHECK: %{{.+}} = cir.bit.ctz(%{{.+}} : !u16i) : !s32i
// CIR: cir.func @_Z17test_builtin_ctzst
// CIR: %{{.+}} = cir.bit.ctz(%{{.+}} : !u16i) : !s32i
// CHEKC: }

int test_builtin_ctz(unsigned x) {
return __builtin_ctz(x);
}

// CHECK: cir.func @_Z16test_builtin_ctzj
// CHECK: %{{.+}} = cir.bit.ctz(%{{.+}} : !u32i) : !s32i
// CHECK: }
// CIR: cir.func @_Z16test_builtin_ctzj
// CIR: %{{.+}} = cir.bit.ctz(%{{.+}} : !u32i) : !s32i
// CIR: }

int test_builtin_ctzl(unsigned long x) {
return __builtin_ctzl(x);
}

// CHECK: cir.func @_Z17test_builtin_ctzlm
// CHECK: %{{.+}} = cir.bit.ctz(%{{.+}} : !u64i) : !s32i
// CHECK: }
// CIR: cir.func @_Z17test_builtin_ctzlm
// CIR: %{{.+}} = cir.bit.ctz(%{{.+}} : !u64i) : !s32i
// CIR: }

int test_builtin_ctzll(unsigned long long x) {
return __builtin_ctzll(x);
}

// CHECK: cir.func @_Z18test_builtin_ctzlly
// CHECK: %{{.+}} = cir.bit.ctz(%{{.+}} : !u64i) : !s32i
// CHECK: }
// CIR: cir.func @_Z18test_builtin_ctzlly
// CIR: %{{.+}} = cir.bit.ctz(%{{.+}} : !u64i) : !s32i
// CIR: }

int test_builtin_ctzg(unsigned x) {
return __builtin_ctzg(x);
}

// CHECK: cir.func @_Z17test_builtin_ctzgj
// CHECK: %{{.+}} = cir.bit.ctz(%{{.+}} : !u32i) : !s32i
// CHECK: }
// CIR: cir.func @_Z17test_builtin_ctzgj
// CIR: %{{.+}} = cir.bit.ctz(%{{.+}} : !u32i) : !s32i
// CIR: }

int test_builtin_clzs(unsigned short x) {
return __builtin_clzs(x);
}

// CHECK: cir.func @_Z17test_builtin_clzst
// CHECK: %{{.+}} = cir.bit.clz(%{{.+}} : !u16i) : !s32i
// CHECK: }
// CIR: cir.func @_Z17test_builtin_clzst
// CIR: %{{.+}} = cir.bit.clz(%{{.+}} : !u16i) : !s32i
// CIR: }

int test_builtin_clz(unsigned x) {
return __builtin_clz(x);
}

// CHECK: cir.func @_Z16test_builtin_clzj
// CHECK: %{{.+}} = cir.bit.clz(%{{.+}} : !u32i) : !s32i
// CHECK: }
// CIR: cir.func @_Z16test_builtin_clzj
// CIR: %{{.+}} = cir.bit.clz(%{{.+}} : !u32i) : !s32i
// CIR: }

int test_builtin_clzl(unsigned long x) {
return __builtin_clzl(x);
}

// CHECK: cir.func @_Z17test_builtin_clzlm
// CHECK: %{{.+}} = cir.bit.clz(%{{.+}} : !u64i) : !s32i
// CHECK: }
// CIR: cir.func @_Z17test_builtin_clzlm
// CIR: %{{.+}} = cir.bit.clz(%{{.+}} : !u64i) : !s32i
// CIR: }

int test_builtin_clzll(unsigned long long x) {
return __builtin_clzll(x);
}

// CHECK: cir.func @_Z18test_builtin_clzlly
// CHECK: %{{.+}} = cir.bit.clz(%{{.+}} : !u64i) : !s32i
// CHECK: }
// CIR: cir.func @_Z18test_builtin_clzlly
// CIR: %{{.+}} = cir.bit.clz(%{{.+}} : !u64i) : !s32i
// CIR: }

int test_builtin_clzg(unsigned x) {
return __builtin_clzg(x);
}

// CHECK: cir.func @_Z17test_builtin_clzgj
// CHECK: %{{.+}} = cir.bit.clz(%{{.+}} : !u32i) : !s32i
// CHECK: }
// CIR: cir.func @_Z17test_builtin_clzgj
// CIR: %{{.+}} = cir.bit.clz(%{{.+}} : !u32i) : !s32i
// CIR: }

int test_builtin_ffs(int x) {
return __builtin_ffs(x);
}

// CHECK: cir.func @_Z16test_builtin_ffsi
// CHECK: %{{.+}} = cir.bit.ffs(%{{.+}} : !s32i) : !s32i
// CHECK: }
// CIR: cir.func @_Z16test_builtin_ffsi
// CIR: %{{.+}} = cir.bit.ffs(%{{.+}} : !s32i) : !s32i
// CIR: }

int test_builtin_ffsl(long x) {
return __builtin_ffsl(x);
}

// CHECK: cir.func @_Z17test_builtin_ffsll
// CHECK: %{{.+}} = cir.bit.ffs(%{{.+}} : !s64i) : !s32i
// CHECK: }
// CIR: cir.func @_Z17test_builtin_ffsll
// CIR: %{{.+}} = cir.bit.ffs(%{{.+}} : !s64i) : !s32i
// CIR: }

int test_builtin_ffsll(long long x) {
return __builtin_ffsll(x);
}

// CHECK: cir.func @_Z18test_builtin_ffsllx
// CHECK: %{{.+}} = cir.bit.ffs(%{{.+}} : !s64i) : !s32i
// CHECK: }
// CIR: cir.func @_Z18test_builtin_ffsllx
// CIR: %{{.+}} = cir.bit.ffs(%{{.+}} : !s64i) : !s32i
// CIR: }

int test_builtin_parity(unsigned x) {
return __builtin_parity(x);
}

// CHECK: cir.func @_Z19test_builtin_parityj
// CHECK: %{{.+}} = cir.bit.parity(%{{.+}} : !u32i) : !s32i
// CHECK: }
// CIR: cir.func @_Z19test_builtin_parityj
// CIR: %{{.+}} = cir.bit.parity(%{{.+}} : !u32i) : !s32i
// CIR: }

int test_builtin_parityl(unsigned long x) {
return __builtin_parityl(x);
}

// CHECK: cir.func @_Z20test_builtin_paritylm
// CHECK: %{{.+}} = cir.bit.parity(%{{.+}} : !u64i) : !s32i
// CHECK: }
// CIR: cir.func @_Z20test_builtin_paritylm
// CIR: %{{.+}} = cir.bit.parity(%{{.+}} : !u64i) : !s32i
// CIR: }

int test_builtin_parityll(unsigned long long x) {
return __builtin_parityll(x);
}

// CHECK: cir.func @_Z21test_builtin_paritylly
// CHECK: %{{.+}} = cir.bit.parity(%{{.+}} : !u64i) : !s32i
// CHECK: }
// CIR: cir.func @_Z21test_builtin_paritylly
// CIR: %{{.+}} = cir.bit.parity(%{{.+}} : !u64i) : !s32i
// CIR: }

int test_builtin_popcount(unsigned x) {
return __builtin_popcount(x);
}

// CHECK: cir.func @_Z21test_builtin_popcountj
// CHECK: %{{.+}} = cir.bit.popcount(%{{.+}} : !u32i) : !s32i
// CHECK: }
// CIR: cir.func @_Z21test_builtin_popcountj
// CIR: %{{.+}} = cir.bit.popcount(%{{.+}} : !u32i) : !s32i
// CIR: }

int test_builtin_popcountl(unsigned long x) {
return __builtin_popcountl(x);
}

// CHECK: cir.func @_Z22test_builtin_popcountlm
// CHECK: %{{.+}} = cir.bit.popcount(%{{.+}} : !u64i) : !s32i
// CHECK: }
// CIR: cir.func @_Z22test_builtin_popcountlm
// CIR: %{{.+}} = cir.bit.popcount(%{{.+}} : !u64i) : !s32i
// CIR: }

int test_builtin_popcountll(unsigned long long x) {
return __builtin_popcountll(x);
}

// CHECK: cir.func @_Z23test_builtin_popcountlly
// CHECK: %{{.+}} = cir.bit.popcount(%{{.+}} : !u64i) : !s32i
// CHECK: }
// CIR: cir.func @_Z23test_builtin_popcountlly
// CIR: %{{.+}} = cir.bit.popcount(%{{.+}} : !u64i) : !s32i
// CIR: }

int test_builtin_popcountg(unsigned x) {
return __builtin_popcountg(x);
}

// CHECK: cir.func @_Z22test_builtin_popcountgj
// CHECK: %{{.+}} = cir.bit.popcount(%{{.+}} : !u32i) : !s32i
// CHECK: }
// CIR: cir.func @_Z22test_builtin_popcountgj
// CIR: %{{.+}} = cir.bit.popcount(%{{.+}} : !u32i) : !s32i
// CIR: }
15 changes: 8 additions & 7 deletions clang/test/CIR/CodeGen/builtin-constant-evaluated.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o - | FileCheck %s
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir
// RUN: FileCheck %s --check-prefix=CIR --input-file=%t.cir

auto func() {
return __builtin_strcmp("", "");
// CHECK: cir.func @_Z4funcv()
// CHECK-NEXT: %0 = cir.alloca !s32i, !cir.ptr<!s32i>, ["__retval"] {alignment = 4 : i64} loc(#loc2)
// CHECK-NEXT: %1 = cir.const #cir.int<0> : !s32i loc(#loc7)
// CHECK-NEXT: cir.store %1, %0 : !s32i, !cir.ptr<!s32i> loc(#loc8)
// CHECK-NEXT: %2 = cir.load %0 : !cir.ptr<!s32i>, !s32i loc(#loc8)
// CHECK-NEXT: cir.return %2 : !s32i loc(#loc8)
// CIR: cir.func @_Z4funcv()
// CIR-NEXT: %0 = cir.alloca !s32i, !cir.ptr<!s32i>, ["__retval"] {alignment = 4 : i64} loc(#loc2)
// CIR-NEXT: %1 = cir.const #cir.int<0> : !s32i loc(#loc7)
// CIR-NEXT: cir.store %1, %0 : !s32i, !cir.ptr<!s32i> loc(#loc8)
// CIR-NEXT: %2 = cir.load %0 : !cir.ptr<!s32i>, !s32i loc(#loc8)
// CIR-NEXT: cir.return %2 : !s32i loc(#loc8)
}
Loading