Skip to content

[RISCV] Add pre-defined macro tests for Andes vendor extension. NFC. #141172

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tclin914
Copy link
Contributor

No description provided.

@llvmbot llvmbot added clang Clang issues not falling into any other category backend:RISC-V labels May 23, 2025
@llvmbot
Copy link
Member

llvmbot commented May 23, 2025

@llvm/pr-subscribers-clang

Author: Jim Lin (tclin914)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/141172.diff

1 Files Affected:

  • (added) clang/test/Preprocessor/riscv-target-features-andes.c (+32)
diff --git a/clang/test/Preprocessor/riscv-target-features-andes.c b/clang/test/Preprocessor/riscv-target-features-andes.c
new file mode 100644
index 0000000000000..3cd9b04354132
--- /dev/null
+++ b/clang/test/Preprocessor/riscv-target-features-andes.c
@@ -0,0 +1,32 @@
+// RUN: %clang --target=riscv32-unknown-linux-gnu -march=rv32i -E -dM %s \
+// RUN:   -o - | FileCheck %s
+// RUN: %clang --target=riscv64-unknown-linux-gnu -march=rv64i -E -dM %s \
+// RUN:   -o - | FileCheck %s
+
+// CHECK-NOT: __riscv_xandesperf {{.*$}}
+// CHECK-NOT: __riscv_xandesvpackfph {{.*$}}
+// CHECK-NOT: __riscv_xandesvdot {{.*$}}
+
+// RUN: %clang --target=riscv32 \
+// RUN:   -march=rv32i_xandesperf -E -dM %s \
+// RUN:   -o - | FileCheck --check-prefix=CHECK-XANDESPERF %s
+// RUN: %clang --target=riscv64 \
+// RUN:   -march=rv64i_xandesperf -E -dM %s \
+// RUN:   -o - | FileCheck --check-prefix=CHECK-XANDESPERF %s
+// CHECK-XANDESPERF: __riscv_xandesperf  5000000{{$}}
+
+// RUN: %clang --target=riscv32 \
+// RUN:   -march=rv32i_xandesvpackfph -E -dM %s \
+// RUN:   -o - | FileCheck --check-prefix=CHECK-XANDESVPACKFPH %s
+// RUN: %clang --target=riscv64 \
+// RUN:   -march=rv64i_xandesvpackfph -E -dM %s \
+// RUN:   -o - | FileCheck --check-prefix=CHECK-XANDESVPACKFPH %s
+// CHECK-XANDESVPACKFPH: __riscv_xandesvpackfph  5000000{{$}}
+
+// RUN: %clang --target=riscv32 \
+// RUN:   -march=rv32i_xandesvdot -E -dM %s \
+// RUN:   -o - | FileCheck --check-prefix=CHECK-XANDESVDOT %s
+// RUN: %clang --target=riscv64 \
+// RUN:   -march=rv64i_xandesvdot -E -dM %s \
+// RUN:   -o - | FileCheck --check-prefix=CHECK-XANDESVDOT %s
+// CHECK-XANDESVDOT: __riscv_xandesvdot  5000000{{$}}

@llvmbot
Copy link
Member

llvmbot commented May 23, 2025

@llvm/pr-subscribers-backend-risc-v

Author: Jim Lin (tclin914)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/141172.diff

1 Files Affected:

  • (added) clang/test/Preprocessor/riscv-target-features-andes.c (+32)
diff --git a/clang/test/Preprocessor/riscv-target-features-andes.c b/clang/test/Preprocessor/riscv-target-features-andes.c
new file mode 100644
index 0000000000000..3cd9b04354132
--- /dev/null
+++ b/clang/test/Preprocessor/riscv-target-features-andes.c
@@ -0,0 +1,32 @@
+// RUN: %clang --target=riscv32-unknown-linux-gnu -march=rv32i -E -dM %s \
+// RUN:   -o - | FileCheck %s
+// RUN: %clang --target=riscv64-unknown-linux-gnu -march=rv64i -E -dM %s \
+// RUN:   -o - | FileCheck %s
+
+// CHECK-NOT: __riscv_xandesperf {{.*$}}
+// CHECK-NOT: __riscv_xandesvpackfph {{.*$}}
+// CHECK-NOT: __riscv_xandesvdot {{.*$}}
+
+// RUN: %clang --target=riscv32 \
+// RUN:   -march=rv32i_xandesperf -E -dM %s \
+// RUN:   -o - | FileCheck --check-prefix=CHECK-XANDESPERF %s
+// RUN: %clang --target=riscv64 \
+// RUN:   -march=rv64i_xandesperf -E -dM %s \
+// RUN:   -o - | FileCheck --check-prefix=CHECK-XANDESPERF %s
+// CHECK-XANDESPERF: __riscv_xandesperf  5000000{{$}}
+
+// RUN: %clang --target=riscv32 \
+// RUN:   -march=rv32i_xandesvpackfph -E -dM %s \
+// RUN:   -o - | FileCheck --check-prefix=CHECK-XANDESVPACKFPH %s
+// RUN: %clang --target=riscv64 \
+// RUN:   -march=rv64i_xandesvpackfph -E -dM %s \
+// RUN:   -o - | FileCheck --check-prefix=CHECK-XANDESVPACKFPH %s
+// CHECK-XANDESVPACKFPH: __riscv_xandesvpackfph  5000000{{$}}
+
+// RUN: %clang --target=riscv32 \
+// RUN:   -march=rv32i_xandesvdot -E -dM %s \
+// RUN:   -o - | FileCheck --check-prefix=CHECK-XANDESVDOT %s
+// RUN: %clang --target=riscv64 \
+// RUN:   -march=rv64i_xandesvdot -E -dM %s \
+// RUN:   -o - | FileCheck --check-prefix=CHECK-XANDESVDOT %s
+// CHECK-XANDESVDOT: __riscv_xandesvdot  5000000{{$}}

@tclin914
Copy link
Contributor Author

tclin914 commented Jun 2, 2025

Kindly ping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:RISC-V clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants