[clang] [CIR] Add non-floating-point builtin intrinsics (PR #178093)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 13 15:15:30 PST 2026


================
@@ -35,3 +44,33 @@ float testFabsf(float x) {
   return fabsf(x);
   // CHECK: cir.fabs %{{.+}} : !cir.float
 }
+
+int abs(int);
+int testAbs(int x) {
+  return abs(x);
+  // CHECK: cir.abs %{{.+}} min_is_poison : !s32i
+  // LLVM: %{{.+}} = call i32 @llvm.abs.i32(i32 %{{.+}}, i1 true)
+  // OGCG: %{{.+}} = call i32 @llvm.abs.i32(i32 %{{.+}}, i1 true)
+  // CIR_NO_POISON: cir.abs %{{.+}} : !s32i
----------------
andykaylor wrote:

This would still pass if we emitted `min_is_poison`. I think you need the wildcard match to end when it encounters a space. I think this will work.
```suggestion
  // CIR_NO_POISON: cir.abs %{{\S+}} : !s32i
```

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


More information about the cfe-commits mailing list