[clang] [CIR][X86]Implement handling for shiftleft/shiftright builtins in CIR (PR #175049)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 8 16:50:38 PST 2026


================
@@ -0,0 +1,60 @@
+// RUN: %clang_cc1 -ffreestanding -fms-extensions -triple x86_64-unknown-linux-gnu \
+// RUN:         -Oz -fclangir -emit-cir %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR
+
+// RUN: %clang_cc1 -ffreestanding -fms-extensions -triple x86_64-unknown-linux-gnu \
+// RUN:         -Oz -fclangir -emit-llvm %s -o %t.ll
+// RUN: FileCheck --input-file=%t.ll %s -check-prefix=LLVM
+
+// RUN: %clang_cc1 -ffreestanding -fms-extensions -triple x86_64-unknown-linux-gnu \
+// RUN:         -Oz -emit-llvm %s -o %t.ll
+// RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG
+
+unsigned __int64 __shiftleft128(unsigned __int64 low, unsigned __int64 high,
+                                unsigned char shift);
+unsigned __int64 __shiftright128(unsigned __int64 low, unsigned __int64 high,
+                                 unsigned char shift);
+
+// CIR-LABEL: cir.func{{.*}}@test_shiftleft128
+// CIR: (%[[L:[^,]+]]: !u64i{{.*}}, %[[H:[^,]+]]: !u64i{{.*}}, %[[D:[^,]+]]: !u8i{{.*}})
----------------
andykaylor wrote:

This doesn't seem to be doing anything useful. Maybe just omit this entirely. You can set the variables for the arguments from the ops where they are re-loaded from their allocas then use them in the call check (similar to what you did with the shift amount argument.

https://github.com/llvm/llvm-project/pull/175049


More information about the cfe-commits mailing list