Skip to content

[CIR][NFC] Move some builtin tests to the CodeGenBuitins folder - #183607

Merged
andykaylor merged 7 commits into
llvm:mainfrom
ayokunle321:move-builtin-tests
Feb 28, 2026
Merged

andykaylor merged 7 commits into
llvm:mainfrom
ayokunle321:move-builtin-tests

Conversation

@ayokunle321

@ayokunle321 ayokunle321 commented Feb 26, 2026

Copy link
Copy Markdown
Contributor

This moves a few tests that were created in the wrong location. Also changes the names of some test files to maintain consistency.

@ayokunle321 ayokunle321 changed the title Move some builtin tests to the CodeGenBuitins folder [CIR] Move some builtin tests to the CodeGenBuitins folder Feb 26, 2026
@llvmbot llvmbot added clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project labels Feb 26, 2026
@llvmbot

llvmbot commented Feb 26, 2026

Copy link
Copy Markdown
Member

@llvm/pr-subscribers-clangir

@llvm/pr-subscribers-clang

Author: Ayokunle Amodu (ayokunle321)

Changes

This moves a few tests that were created in the wrong location.


Patch is 52.04 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/183607.diff

5 Files Affected:

  • (removed) clang/test/CIR/CodeGen/builtins-elementwise.c (-515)
  • (renamed) clang/test/CIR/CodeGenBuiltins/builtin-bit-cast.cpp ()
  • (renamed) clang/test/CIR/CodeGenBuiltins/builtin-floating-point.c ()
  • (renamed) clang/test/CIR/CodeGenBuiltins/builtin-memchr.c ()
  • (modified) clang/test/CIR/CodeGenBuiltins/builtins-elementwise.c (+460-43)
diff --git a/clang/test/CIR/CodeGen/builtins-elementwise.c b/clang/test/CIR/CodeGen/builtins-elementwise.c
deleted file mode 100644
index 6c31ce19788d9..0000000000000
--- a/clang/test/CIR/CodeGen/builtins-elementwise.c
+++ /dev/null
@@ -1,515 +0,0 @@
-// RUN: %clang_cc1 -triple aarch64-none-linux-android24  -emit-cir %s -o %t.cir
-// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s
-// RUN: %clang_cc1 -triple aarch64-none-linux-android24  -fclangir \
-// RUN:  -emit-llvm  %s -o %t.ll
-// RUN: FileCheck  --check-prefix=LLVM --input-file=%t.ll %s
-// RUN: %clang_cc1 -triple aarch64-none-linux-android24 -emit-llvm %s -o %t-ogcg.ll
-// RUN: FileCheck --check-prefix=OGCG --input-file=%t-ogcg.ll %s
-
-typedef int vint4 __attribute__((ext_vector_type(4)));
-typedef float vfloat4 __attribute__((ext_vector_type(4)));
-typedef double vdouble4 __attribute__((ext_vector_type(4)));
-
-void test_builtin_elementwise_abs(vint4 vi4, int i, float f, double d,
-                                  vfloat4 vf4, vdouble4  vd4) {
-    // CIR-LABEL: test_builtin_elementwise_abs
-    // LLVM-LABEL: test_builtin_elementwise_abs
-    // OGCG-LABEL: test_builtin_elementwise_abs
-    // CIR: {{%.*}} = cir.fabs {{%.*}} : !cir.float
-    // LLVM: {{%.*}} = call float @llvm.fabs.f32(float {{%.*}})
-    // OGCG: {{%.*}} = call float @llvm.fabs.f32(float {{%.*}})
-    f = __builtin_elementwise_abs(f);
-
-    // CIR: {{%.*}} = cir.fabs {{%.*}} : !cir.double
-    // LLVM: {{%.*}} = call double @llvm.fabs.f64(double {{%.*}})
-    // OGCG: {{%.*}} = call double @llvm.fabs.f64(double {{%.*}})
-    d = __builtin_elementwise_abs(d);
-
-    // CIR: {{%.*}} = cir.abs {{%.*}} : !cir.vector<4 x !s32i>
-    // LLVM: {{%.*}} = call <4 x i32> @llvm.abs.v4i32(<4 x i32> {{%.*}}, i1 false)
-    // OGCG: {{%.*}} = call <4 x i32> @llvm.abs.v4i32(<4 x i32> {{%.*}}, i1 false)
-    vi4 = __builtin_elementwise_abs(vi4);
-
-    // CIR: {{%.*}} = cir.abs {{%.*}} : !s32
-    // LLVM: {{%.*}} = call i32 @llvm.abs.i32(i32 {{%.*}}, i1 false)
-    // OGCG: {{%.*}} = call i32 @llvm.abs.i32(i32 {{%.*}}, i1 false)
-    i = __builtin_elementwise_abs(i);
-
-    // CIR: {{%.*}} = cir.fabs {{%.*}} : !cir.vector<4 x !cir.float>
-    // LLVM: {{%.*}} = call <4 x float> @llvm.fabs.v4f32(<4 x float> {{%.*}})
-    // OGCG: {{%.*}} = call <4 x float> @llvm.fabs.v4f32(<4 x float> {{%.*}})
-    vf4 = __builtin_elementwise_abs(vf4);
-
-    // CIR: {{%.*}} = cir.fabs {{%.*}} : !cir.vector<4 x !cir.double>
-    // LLVM: {{%.*}} = call <4 x double> @llvm.fabs.v4f64(<4 x double> {{%.*}})
-    // OGCG: {{%.*}} = call <4 x double> @llvm.fabs.v4f64(<4 x double> {{%.*}})
-    vd4 = __builtin_elementwise_abs(vd4);
-}
-
-void test_builtin_elementwise_acos(float f, double d, vfloat4 vf4,
-                                   vdouble4  vd4) {
-  // CIR-LABEL: test_builtin_elementwise_acos
-  // LLVM-LABEL: test_builtin_elementwise_acos
-  // OGCG-LABEL: test_builtin_elementwise_acos
-  // CIR: {{%.*}} = cir.acos {{%.*}} : !cir.float
-  // LLVM: {{%.*}} = call float @llvm.acos.f32(float {{%.*}})
-  // OGCG: {{%.*}} = call float @llvm.acos.f32(float {{%.*}})
-  f = __builtin_elementwise_acos(f);
-
-  // CIR: {{%.*}} = cir.acos {{%.*}} : !cir.double
-  // LLVM: {{%.*}} = call double @llvm.acos.f64(double {{%.*}})
-  // OGCG: {{%.*}} = call double @llvm.acos.f64(double {{%.*}})
-  d = __builtin_elementwise_acos(d);
-
-  // CIR: {{%.*}} = cir.acos {{%.*}} : !cir.vector<4 x !cir.float>
-  // LLVM: {{%.*}} = call <4 x float> @llvm.acos.v4f32(<4 x float> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x float> @llvm.acos.v4f32(<4 x float> {{%.*}})
-  vf4 = __builtin_elementwise_acos(vf4);
-
-  // CIR: {{%.*}} = cir.acos {{%.*}} : !cir.vector<4 x !cir.double>
-  // LLVM: {{%.*}} = call <4 x double> @llvm.acos.v4f64(<4 x double> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x double> @llvm.acos.v4f64(<4 x double> {{%.*}})
-  vd4 = __builtin_elementwise_acos(vd4);
-}
-
-void test_builtin_elementwise_asin(float f, double d, vfloat4 vf4,
-  vdouble4  vd4) {
-  // CIR-LABEL: test_builtin_elementwise_asin
-  // LLVM-LABEL: test_builtin_elementwise_asin
-  // OGCG-LABEL: test_builtin_elementwise_asin
-  // CIR: {{%.*}} = cir.asin {{%.*}} : !cir.float
-  // LLVM: {{%.*}} = call float @llvm.asin.f32(float {{%.*}})
-  // OGCG: {{%.*}} = call float @llvm.asin.f32(float {{%.*}})
-  f = __builtin_elementwise_asin(f);
-
-  // CIR: {{%.*}} = cir.asin {{%.*}} : !cir.double
-  // LLVM: {{%.*}} = call double @llvm.asin.f64(double {{%.*}})
-  // OGCG: {{%.*}} = call double @llvm.asin.f64(double {{%.*}})
-  d = __builtin_elementwise_asin(d);
-
-  // CIR: {{%.*}} = cir.asin {{%.*}} : !cir.vector<4 x !cir.float>
-  // LLVM: {{%.*}} = call <4 x float> @llvm.asin.v4f32(<4 x float> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x float> @llvm.asin.v4f32(<4 x float> {{%.*}})
-  vf4 = __builtin_elementwise_asin(vf4);
-
-  // CIR: {{%.*}} = cir.asin {{%.*}} : !cir.vector<4 x !cir.double>
-  // LLVM: {{%.*}} = call <4 x double> @llvm.asin.v4f64(<4 x double> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x double> @llvm.asin.v4f64(<4 x double> {{%.*}})
-  vd4 = __builtin_elementwise_asin(vd4);
-}
-
-void test_builtin_elementwise_atan(float f, double d, vfloat4 vf4,
-  vdouble4  vd4) {
-  // CIR-LABEL: test_builtin_elementwise_atan
-  // LLVM-LABEL: test_builtin_elementwise_atan
-  // OGCG-LABEL: test_builtin_elementwise_atan
-  // CIR: {{%.*}} = cir.atan {{%.*}} : !cir.float
-  // LLVM: {{%.*}} = call float @llvm.atan.f32(float {{%.*}})
-  // OGCG: {{%.*}} = call float @llvm.atan.f32(float {{%.*}})
-  f = __builtin_elementwise_atan(f);
-
-  // CIR: {{%.*}} = cir.atan {{%.*}} : !cir.double
-  // LLVM: {{%.*}} = call double @llvm.atan.f64(double {{%.*}})
-  // OGCG: {{%.*}} = call double @llvm.atan.f64(double {{%.*}})
-  d = __builtin_elementwise_atan(d);
-
-  // CIR: {{%.*}} = cir.atan {{%.*}} : !cir.vector<4 x !cir.float>
-  // LLVM: {{%.*}} = call <4 x float> @llvm.atan.v4f32(<4 x float> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x float> @llvm.atan.v4f32(<4 x float> {{%.*}})
-  vf4 = __builtin_elementwise_atan(vf4);
-
-  // CIR: {{%.*}} = cir.atan {{%.*}} : !cir.vector<4 x !cir.double>
-  // LLVM: {{%.*}} = call <4 x double> @llvm.atan.v4f64(<4 x double> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x double> @llvm.atan.v4f64(<4 x double> {{%.*}})
-  vd4 = __builtin_elementwise_atan(vd4);
-}
-
-void test_builtin_elementwise_atan2(float f, double d, vfloat4 vf4,
-  vdouble4  vd4) {
-  // CIR-LABEL: test_builtin_elementwise_atan2
-  // LLVM-LABEL: test_builtin_elementwise_atan2
-  // OGCG-LABEL: test_builtin_elementwise_atan2
-  // CIR: {{%.*}} = cir.atan2 {{%.*}}, {{%.*}} : !cir.float
-  // LLVM: {{%.*}} = call float @llvm.atan2.f32(float {{%.*}}, float {{%.*}})
-  // OGCG: {{%.*}} = call float @llvm.atan2.f32(float {{%.*}}, float {{%.*}})
-  f = __builtin_elementwise_atan2(f, f);
-
-  // CIR: {{%.*}} = cir.atan2 {{%.*}}, {{%.*}} : !cir.double
-  // LLVM: {{%.*}} = call double @llvm.atan2.f64(double {{%.*}}, double {{%.*}})
-  // OGCG: {{%.*}} = call double @llvm.atan2.f64(double {{%.*}}, double {{%.*}})
-  d = __builtin_elementwise_atan2(d, d);
-
-  // CIR: {{%.*}} = cir.atan2 {{%.*}}, {{%.*}} : !cir.vector<4 x !cir.float>
-  // LLVM: {{%.*}} = call <4 x float> @llvm.atan2.v4f32(<4 x float> {{%.*}}, <4 x float> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x float> @llvm.atan2.v4f32(<4 x float> {{%.*}}, <4 x float> {{%.*}})
-  vf4 = __builtin_elementwise_atan2(vf4, vf4);
-
-  // CIR: {{%.*}} = cir.atan2 {{%.*}}, {{%.*}} : !cir.vector<4 x !cir.double>
-  // LLVM: {{%.*}} = call <4 x double> @llvm.atan2.v4f64(<4 x double> {{%.*}}, <4 x double> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x double> @llvm.atan2.v4f64(<4 x double> {{%.*}}, <4 x double> {{%.*}})
-  vd4 = __builtin_elementwise_atan2(vd4, vd4);
-}
-
-void test_builtin_elementwise_exp(float f, double d, vfloat4 vf4,
-                                  vdouble4  vd4) {
-  // CIR-LABEL: test_builtin_elementwise_exp
-  // LLVM-LABEL: test_builtin_elementwise_exp
-  // OGCG-LABEL: test_builtin_elementwise_exp
-  // CIR: {{%.*}} = cir.exp {{%.*}} : !cir.float
-  // LLVM: {{%.*}} = call float @llvm.exp.f32(float {{%.*}})
-  // OGCG: {{%.*}} = call float @llvm.exp.f32(float {{%.*}})
-  f = __builtin_elementwise_exp(f);
-
-  // CIR: {{%.*}} = cir.exp {{%.*}} : !cir.double
-  // LLVM: {{%.*}} = call double @llvm.exp.f64(double {{%.*}})
-  // OGCG: {{%.*}} = call double @llvm.exp.f64(double {{%.*}})
-  d = __builtin_elementwise_exp(d);
-
-  // CIR: {{%.*}} = cir.exp {{%.*}} : !cir.vector<4 x !cir.float>
-  // LLVM: {{%.*}} = call <4 x float> @llvm.exp.v4f32(<4 x float> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x float> @llvm.exp.v4f32(<4 x float> {{%.*}})
-  vf4 = __builtin_elementwise_exp(vf4);
-
-  // CIR: {{%.*}} = cir.exp {{%.*}} : !cir.vector<4 x !cir.double>
-  // LLVM: {{%.*}} = call <4 x double> @llvm.exp.v4f64(<4 x double> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x double> @llvm.exp.v4f64(<4 x double> {{%.*}})
-  vd4 = __builtin_elementwise_exp(vd4);
-}
-
-void test_builtin_elementwise_exp2(float f, double d, vfloat4 vf4,
-                                  vdouble4  vd4) {
-  // CIR-LABEL: test_builtin_elementwise_exp2
-  // LLVM-LABEL: test_builtin_elementwise_exp2
-  // OGCG-LABEL: test_builtin_elementwise_exp2
-  // CIR: {{%.*}} = cir.exp2 {{%.*}} : !cir.float
-  // LLVM: {{%.*}} = call float @llvm.exp2.f32(float {{%.*}})
-  // OGCG: {{%.*}} = call float @llvm.exp2.f32(float {{%.*}})
-  f = __builtin_elementwise_exp2(f);
-
-  // CIR: {{%.*}} = cir.exp2 {{%.*}} : !cir.double
-  // LLVM: {{%.*}} = call double @llvm.exp2.f64(double {{%.*}})
-  // OGCG: {{%.*}} = call double @llvm.exp2.f64(double {{%.*}})
-  d = __builtin_elementwise_exp2(d);
-
-  // CIR: {{%.*}} = cir.exp2 {{%.*}} : !cir.vector<4 x !cir.float>
-  // LLVM: {{%.*}} = call <4 x float> @llvm.exp2.v4f32(<4 x float> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x float> @llvm.exp2.v4f32(<4 x float> {{%.*}})
-  vf4 = __builtin_elementwise_exp2(vf4);
-
-  // CIR: {{%.*}} = cir.exp2 {{%.*}} : !cir.vector<4 x !cir.double>
-  // LLVM: {{%.*}} = call <4 x double> @llvm.exp2.v4f64(<4 x double> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x double> @llvm.exp2.v4f64(<4 x double> {{%.*}})
-  vd4 = __builtin_elementwise_exp2(vd4);
-}
-
-void test_builtin_elementwise_log(float f, double d, vfloat4 vf4,
-                                  vdouble4  vd4) {
-  // CIR-LABEL: test_builtin_elementwise_log
-  // LLVM-LABEL: test_builtin_elementwise_log
-  // OGCG-LABEL: test_builtin_elementwise_log
-  // CIR: {{%.*}} = cir.log {{%.*}} : !cir.float
-  // LLVM: {{%.*}} = call float @llvm.log.f32(float {{%.*}})
-  // OGCG: {{%.*}} = call float @llvm.log.f32(float {{%.*}})
-  f = __builtin_elementwise_log(f);
-
-  // CIR: {{%.*}} = cir.log {{%.*}} : !cir.double
-  // LLVM: {{%.*}} = call double @llvm.log.f64(double {{%.*}})
-  // OGCG: {{%.*}} = call double @llvm.log.f64(double {{%.*}})
-  d = __builtin_elementwise_log(d);
-
-  // CIR: {{%.*}} = cir.log {{%.*}} : !cir.vector<4 x !cir.float>
-  // LLVM: {{%.*}} = call <4 x float> @llvm.log.v4f32(<4 x float> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x float> @llvm.log.v4f32(<4 x float> {{%.*}})
-  vf4 = __builtin_elementwise_log(vf4);
-
-  // CIR: {{%.*}} = cir.log {{%.*}} : !cir.vector<4 x !cir.double>
-  // LLVM: {{%.*}} = call <4 x double> @llvm.log.v4f64(<4 x double> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x double> @llvm.log.v4f64(<4 x double> {{%.*}})
-  vd4 = __builtin_elementwise_log(vd4);
-}
-
-void test_builtin_elementwise_log2(float f, double d, vfloat4 vf4,
-                                    vdouble4  vd4) {
-  // CIR-LABEL: test_builtin_elementwise_log2
-  // LLVM-LABEL: test_builtin_elementwise_log2
-  // OGCG-LABEL: test_builtin_elementwise_log2
-  // CIR: {{%.*}} = cir.log2 {{%.*}} : !cir.float
-  // LLVM: {{%.*}} = call float @llvm.log2.f32(float {{%.*}})
-  // OGCG: {{%.*}} = call float @llvm.log2.f32(float {{%.*}})
-  f = __builtin_elementwise_log2(f);
-
-  // CIR: {{%.*}} = cir.log2 {{%.*}} : !cir.double
-  // LLVM: {{%.*}} = call double @llvm.log2.f64(double {{%.*}})
-  // OGCG: {{%.*}} = call double @llvm.log2.f64(double {{%.*}})
-  d = __builtin_elementwise_log2(d);
-
-  // CIR: {{%.*}} = cir.log2 {{%.*}} : !cir.vector<4 x !cir.float>
-  // LLVM: {{%.*}} = call <4 x float> @llvm.log2.v4f32(<4 x float> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x float> @llvm.log2.v4f32(<4 x float> {{%.*}})
-  vf4 = __builtin_elementwise_log2(vf4);
-
-  // CIR: {{%.*}} = cir.log2 {{%.*}} : !cir.vector<4 x !cir.double>
-  // LLVM: {{%.*}} = call <4 x double> @llvm.log2.v4f64(<4 x double> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x double> @llvm.log2.v4f64(<4 x double> {{%.*}})
-  vd4 = __builtin_elementwise_log2(vd4);
-}
-
-void test_builtin_elementwise_log10(float f, double d, vfloat4 vf4,
-                                     vdouble4  vd4) {
-  // CIR-LABEL: test_builtin_elementwise_log10
-  // LLVM-LABEL: test_builtin_elementwise_log10
-  // OGCG-LABEL: test_builtin_elementwise_log10
-  // CIR: {{%.*}} = cir.log10 {{%.*}} : !cir.float
-  // LLVM: {{%.*}} = call float @llvm.log10.f32(float {{%.*}})
-  // OGCG: {{%.*}} = call float @llvm.log10.f32(float {{%.*}})
-  f = __builtin_elementwise_log10(f);
-
-  // CIR: {{%.*}} = cir.log10 {{%.*}} : !cir.double
-  // LLVM: {{%.*}} = call double @llvm.log10.f64(double {{%.*}})
-  // OGCG: {{%.*}} = call double @llvm.log10.f64(double {{%.*}})
-  d = __builtin_elementwise_log10(d);
-
-  // CIR: {{%.*}} = cir.log10 {{%.*}} : !cir.vector<4 x !cir.float>
-  // LLVM: {{%.*}} = call <4 x float> @llvm.log10.v4f32(<4 x float> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x float> @llvm.log10.v4f32(<4 x float> {{%.*}})
-  vf4 = __builtin_elementwise_log10(vf4);
-
-  // CIR: {{%.*}} = cir.log10 {{%.*}} : !cir.vector<4 x !cir.double>
-  // LLVM: {{%.*}} = call <4 x double> @llvm.log10.v4f64(<4 x double> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x double> @llvm.log10.v4f64(<4 x double> {{%.*}})
-  vd4 = __builtin_elementwise_log10(vd4);
-}
-
-void test_builtin_elementwise_cos(float f, double d, vfloat4 vf4,
-                                     vdouble4 vd4) {
-  // CIR-LABEL: test_builtin_elementwise_cos
-  // LLVM-LABEL: test_builtin_elementwise_cos
-  // OGCG-LABEL: test_builtin_elementwise_cos
-  // CIR: {{%.*}} = cir.cos {{%.*}} : !cir.float
-  // LLVM: {{%.*}} = call float @llvm.cos.f32(float {{%.*}})
-  // OGCG: {{%.*}} = call float @llvm.cos.f32(float {{%.*}})
-  f = __builtin_elementwise_cos(f);
-
-  // CIR: {{%.*}} = cir.cos {{%.*}} : !cir.double
-  // LLVM: {{%.*}} = call double @llvm.cos.f64(double {{%.*}})
-  // OGCG: {{%.*}} = call double @llvm.cos.f64(double {{%.*}})
-  d = __builtin_elementwise_cos(d);
-
-  // CIR: {{%.*}} = cir.cos {{%.*}} : !cir.vector<4 x !cir.float>
-  // LLVM: {{%.*}} = call <4 x float> @llvm.cos.v4f32(<4 x float> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x float> @llvm.cos.v4f32(<4 x float> {{%.*}})
-  vf4 = __builtin_elementwise_cos(vf4);
-
-  // CIR: {{%.*}} = cir.cos {{%.*}} : !cir.vector<4 x !cir.double>
-  // LLVM: {{%.*}} = call <4 x double> @llvm.cos.v4f64(<4 x double> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x double> @llvm.cos.v4f64(<4 x double> {{%.*}})
-  vd4 = __builtin_elementwise_cos(vd4);
-}
-
-void test_builtin_elementwise_floor(float f, double d, vfloat4 vf4,
-                   vdouble4 vd4) {
-  // CIR-LABEL: test_builtin_elementwise_floor
-  // LLVM-LABEL: test_builtin_elementwise_floor
-  // OGCG-LABEL: test_builtin_elementwise_floor
-  // CIR: {{%.*}} = cir.floor {{%.*}} : !cir.float
-  // LLVM: {{%.*}} = call float @llvm.floor.f32(float {{%.*}})
-  // OGCG: {{%.*}} = call float @llvm.floor.f32(float {{%.*}})
-  f = __builtin_elementwise_floor(f);
-
-  // CIR: {{%.*}} = cir.floor {{%.*}} : !cir.double
-  // LLVM: {{%.*}} = call double @llvm.floor.f64(double {{%.*}})
-  // OGCG: {{%.*}} = call double @llvm.floor.f64(double {{%.*}})
-  d = __builtin_elementwise_floor(d);
-
-  // CIR: {{%.*}} = cir.floor {{%.*}} : !cir.vector<4 x !cir.float>
-  // LLVM: {{%.*}} = call <4 x float> @llvm.floor.v4f32(<4 x float> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x float> @llvm.floor.v4f32(<4 x float> {{%.*}})
-  vf4 = __builtin_elementwise_floor(vf4);
-
-  // CIR: {{%.*}} = cir.floor {{%.*}} : !cir.vector<4 x !cir.double>
-  // LLVM: {{%.*}} = call <4 x double> @llvm.floor.v4f64(<4 x double> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x double> @llvm.floor.v4f64(<4 x double> {{%.*}})
-  vd4 = __builtin_elementwise_floor(vd4);
-}
-
-void test_builtin_elementwise_round(float f, double d, vfloat4 vf4,
-                   vdouble4 vd4) {
-  // CIR-LABEL: test_builtin_elementwise_round
-  // LLVM-LABEL: test_builtin_elementwise_round
-  // OGCG-LABEL: test_builtin_elementwise_round
-  // CIR: {{%.*}} = cir.round {{%.*}} : !cir.float
-  // LLVM: {{%.*}} = call float @llvm.round.f32(float {{%.*}})
-  // OGCG: {{%.*}} = call float @llvm.round.f32(float {{%.*}})
-  f = __builtin_elementwise_round(f);
-
-  // CIR: {{%.*}} = cir.round {{%.*}} : !cir.double
-  // LLVM: {{%.*}} = call double @llvm.round.f64(double {{%.*}})
-  // OGCG: {{%.*}} = call double @llvm.round.f64(double {{%.*}})
-  d = __builtin_elementwise_round(d);
-
-  // CIR: {{%.*}} = cir.round {{%.*}} : !cir.vector<4 x !cir.float>
-  // LLVM: {{%.*}} = call <4 x float> @llvm.round.v4f32(<4 x float> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x float> @llvm.round.v4f32(<4 x float> {{%.*}})
-  vf4 = __builtin_elementwise_round(vf4);
-
-  // CIR: {{%.*}} = cir.round {{%.*}} : !cir.vector<4 x !cir.double>
-  // LLVM: {{%.*}} = call <4 x double> @llvm.round.v4f64(<4 x double> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x double> @llvm.round.v4f64(<4 x double> {{%.*}})
-  vd4 = __builtin_elementwise_round(vd4);
-}
-
-void test_builtin_elementwise_rint(float f, double d, vfloat4 vf4,
-                   vdouble4 vd4) {
-  // CIR-LABEL: test_builtin_elementwise_rint
-  // LLVM-LABEL: test_builtin_elementwise_rint
-  // OGCG-LABEL: test_builtin_elementwise_rint
-  // CIR: {{%.*}} = cir.rint {{%.*}} : !cir.float
-  // LLVM: {{%.*}} = call float @llvm.rint.f32(float {{%.*}})
-  // OGCG: {{%.*}} = call float @llvm.rint.f32(float {{%.*}})
-  f = __builtin_elementwise_rint(f);
-
-  // CIR: {{%.*}} = cir.rint {{%.*}} : !cir.double
-  // LLVM: {{%.*}} = call double @llvm.rint.f64(double {{%.*}})
-  // OGCG: {{%.*}} = call double @llvm.rint.f64(double {{%.*}})
-  d = __builtin_elementwise_rint(d);
-
-  // CIR: {{%.*}} = cir.rint {{%.*}} : !cir.vector<4 x !cir.float>
-  // LLVM: {{%.*}} = call <4 x float> @llvm.rint.v4f32(<4 x float> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x float> @llvm.rint.v4f32(<4 x float> {{%.*}})
-  vf4 = __builtin_elementwise_rint(vf4);
-
-  // CIR: {{%.*}} = cir.rint {{%.*}} : !cir.vector<4 x !cir.double>
-  // LLVM: {{%.*}} = call <4 x double> @llvm.rint.v4f64(<4 x double> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x double> @llvm.rint.v4f64(<4 x double> {{%.*}})
-  vd4 = __builtin_elementwise_rint(vd4);
-}
-
-void test_builtin_elementwise_nearbyint(float f, double d, vfloat4 vf4,
-                   vdouble4 vd4) {
-  // CIR-LABEL: test_builtin_elementwise_nearbyint
-  // LLVM-LABEL: test_builtin_elementwise_nearbyint
-  // OGCG-LABEL: test_builtin_elementwise_nearbyint
-  // CIR: {{%.*}} = cir.nearbyint {{%.*}} : !cir.float
-  // LLVM: {{%.*}} = call float @llvm.nearbyint.f32(float {{%.*}})
-  // OGCG: {{%.*}} = call float @llvm.nearbyint.f32(float {{%.*}})
-  f = __builtin_elementwise_nearbyint(f);
-
-  // CIR: {{%.*}} = cir.nearbyint {{%.*}} : !cir.double
-  // LLVM: {{%.*}} = call double @llvm.nearbyint.f64(double {{%.*}})
-  // OGCG: {{%.*}} = call double @llvm.nearbyint.f64(double {{%.*}})
-  d = __builtin_elementwise_nearbyint(d);
-
-  // CIR: {{%.*}} = cir.nearbyint {{%.*}} : !cir.vector<4 x !cir.float>
-  // LLVM: {{%.*}} = call <4 x float> @llvm.nearbyint.v4f32(<4 x float> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x float> @llvm.nearbyint.v4f32(<4 x float> {{%.*}})
-  vf4 = __builtin_elementwise_nearbyint(vf4);
-
-  // CIR: {{%.*}} = cir.nearbyint {{%.*}} : !cir.vector<4 x !cir.double>
-  // LLVM: {{%.*}} = call <4 x double> @llvm.nearbyint.v4f64(<4 x double> {{%.*}})
-  // OGCG: {{%.*}} = call <4 x double> @llvm.nearbyint.v4f64(<4 x double> {{%.*}})
-  vd4 = __builtin_elementwise_nearbyint(vd4);
-}
-
-void test_builtin_elementwise_sin(float f, double d, vfloat4 vf4,
-                   vdouble4 vd4) {
-  // CIR-LABEL: test_builtin_elementwise_sin
-  // LLVM-LABEL: test_builtin_elementwise_sin
-  // OGCG-LABEL: test_builtin_elementwise...
[truncated]

@ayokunle321

Copy link
Copy Markdown
Contributor Author

@andykaylor

I was wondering if and where to move the tests builtinx86.c to CodeGenBuiltins/X86. For instance, I thought of moving the fence instructions from builtinx86.c to sse2builtins.c but sse2builtins.c is meant to mirror OG and OG does not have variants of the builtin, e.g., __builtin_ia32_lfence() variants. In that case, do I still add them to sse2builtins.c or just make another test file?

@ayokunle321 ayokunle321 changed the title [CIR] Move some builtin tests to the CodeGenBuitins folder [CIR][NFC] Move some builtin tests to the CodeGenBuitins folder Feb 26, 2026
@andykaylor

Copy link
Copy Markdown
Contributor

@andykaylor

I was wondering if and where to move the tests builtinx86.c to CodeGenBuiltins/X86. For instance, I thought of moving the fence instructions from builtinx86.c to sse2builtins.c but sse2builtins.c is meant to mirror OG and OG does not have variants of the builtin, e.g., __builtin_ia32_lfence() variants. In that case, do I still add them to sse2builtins.c or just make another test file?

As a general rule, I think it's best to keep things in the equivalent files to those where they appear in the OG tests. Hopefully, we'll be combining them at some point in the distant future. For now, I wouldn't do anything too disruptive to make that happen.

Comment thread clang/test/CIR/CodeGenBuiltins/builtins-elementwise.c Outdated
@ayokunle321

Copy link
Copy Markdown
Contributor Author

@andykaylor addressed comment.

@andykaylor andykaylor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@andykaylor
andykaylor merged commit 795cfae into llvm:main Feb 28, 2026
10 checks passed
@llvm-ci

llvm-ci commented Feb 28, 2026

Copy link
Copy Markdown

LLVM Buildbot has detected a new failure on builder openmp-offload-sles-build-only running on rocm-worker-hw-04-sles while building clang at step 2 "checkout".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/140/builds/39545

Here is the relevant piece of the build log for the reference
Step 2 (checkout) failure: update (failure)
git version 2.35.3
fatal: unable to access 'https://github.com/llvm/llvm-project.git/': Could not resolve host: github.com
fatal: unable to access 'https://github.com/llvm/llvm-project.git/': Could not resolve host: github.com

@llvm-ci

llvm-ci commented Feb 28, 2026

Copy link
Copy Markdown

LLVM Buildbot has detected a new failure on builder openmp-offload-amdgpu-runtime-2 running on rocm-worker-hw-02 while building clang at step 2 "checkout".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/10/builds/23567

Here is the relevant piece of the build log for the reference
Step 2 (checkout) failure: update (failure)
git version 2.34.1
fatal: unable to access 'https://github.com/llvm/llvm-project.git/': Could not resolve host: github.com
fatal: unable to access 'https://github.com/llvm/llvm-project.git/': Could not resolve host: github.com

@llvm-ci

llvm-ci commented Feb 28, 2026

Copy link
Copy Markdown

LLVM Buildbot has detected a new failure on builder openmp-offload-libc-amdgpu-runtime running on omp-vega20-1 while building clang at step 2 "update-annotated-scripts".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/73/builds/19303

Here is the relevant piece of the build log for the reference
Step 2 (update-annotated-scripts) failure: update (failure)
git version 2.34.1
fatal: unable to access 'https://github.com/llvm/llvm-zorg.git/': Could not resolve host: github.com
fatal: unable to access 'https://github.com/llvm/llvm-zorg.git/': Could not resolve host: github.com

@llvm-ci

llvm-ci commented Feb 28, 2026

Copy link
Copy Markdown

LLVM Buildbot has detected a new failure on builder hip-third-party-libs-test running on ext_buildbot_hw_05-hip-docker while building clang at step 2 "update-annotated-scripts".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/206/builds/14639

Here is the relevant piece of the build log for the reference
Step 2 (update-annotated-scripts) failure: update (failure)
git version 2.34.1
fatal: unable to access 'https://github.com/llvm/llvm-zorg.git/': Could not resolve host: github.com
fatal: unable to access 'https://github.com/llvm/llvm-zorg.git/': Could not resolve host: github.com

@llvm-ci

llvm-ci commented Feb 28, 2026

Copy link
Copy Markdown

LLVM Buildbot has detected a new failure on builder amdgpu-offload-ubuntu-22-cmake-build-only running on rocm-docker-ubu-22 while building clang at step 2 "update-annotated-scripts".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/203/builds/38818

Here is the relevant piece of the build log for the reference
Step 2 (update-annotated-scripts) failure: update (failure)
git version 2.34.1
fatal: unable to access 'https://github.com/llvm/llvm-zorg.git/': Could not resolve host: github.com
fatal: unable to access 'https://github.com/llvm/llvm-zorg.git/': Could not resolve host: github.com

@llvm-ci

llvm-ci commented Feb 28, 2026

Copy link
Copy Markdown

LLVM Buildbot has detected a new failure on builder amdgpu-offload-rhel-8-cmake-build-only running on rocm-docker-rhel-8 while building clang at step 2 "update-annotated-scripts".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/204/builds/37624

Here is the relevant piece of the build log for the reference
Step 2 (update-annotated-scripts) failure: update (failure)
git version 2.43.5
fatal: unable to access 'https://github.com/llvm/llvm-zorg.git/': Could not resolve host: github.com
fatal: unable to access 'https://github.com/llvm/llvm-zorg.git/': Could not resolve host: github.com

@llvm-ci

llvm-ci commented Feb 28, 2026

Copy link
Copy Markdown

LLVM Buildbot has detected a new failure on builder amdgpu-offload-rhel-9-cmake-build-only running on rocm-docker-rhel-9 while building clang at step 2 "update-annotated-scripts".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/205/builds/37603

Here is the relevant piece of the build log for the reference
Step 2 (update-annotated-scripts) failure: update (failure)
git version 2.43.5
fatal: unable to access 'https://github.com/llvm/llvm-zorg.git/': Could not resolve host: github.com
fatal: unable to access 'https://github.com/llvm/llvm-zorg.git/': Could not resolve host: github.com

sahas3 pushed a commit to sahas3/llvm-project that referenced this pull request Mar 4, 2026
…#183607)

This moves a few tests that were created in the wrong location. Also
changes the names of some test files to maintain consistency.
sujianIBM pushed a commit to sujianIBM/llvm-project that referenced this pull request Mar 5, 2026
…#183607)

This moves a few tests that were created in the wrong location. Also
changes the names of some test files to maintain consistency.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants