[clang] [CIR] Remove failing binop test (PR #133001)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 25 14:38:12 PDT 2025
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/133001
When CIR binop support was commited, it accidentally included a test for functionality that was removed during the review process (cir.binop.overflow). This test, of course, fails.
This change removes the failing test. It will be re-added when the corresponding op is added.
>From aec867ce6558b2a7b23abc84f71f794ee0b085bb Mon Sep 17 00:00:00 2001
From: Andy Kaylor <akaylor at nvidia.com>
Date: Tue, 25 Mar 2025 14:35:04 -0700
Subject: [PATCH] [CIR] Remove failing binop test
When CIR binop support was commited, it accidentally included a test for
functionality that was removed during the review process (cir.binop.overflow).
This test, of course, fails.
This change removes the failing test. It will be re-added when the
corresponding op is added.
---
clang/test/CIR/Lowering/binop-overflow.cir | 63 ----------------------
1 file changed, 63 deletions(-)
delete mode 100644 clang/test/CIR/Lowering/binop-overflow.cir
diff --git a/clang/test/CIR/Lowering/binop-overflow.cir b/clang/test/CIR/Lowering/binop-overflow.cir
deleted file mode 100644
index 68af70aa6abb6..0000000000000
--- a/clang/test/CIR/Lowering/binop-overflow.cir
+++ /dev/null
@@ -1,63 +0,0 @@
-// RUN: cir-opt %s -cir-to-llvm -o - | FileCheck %s -check-prefix=MLIR
-// RUN: cir-translate %s -cir-to-llvmir --target x86_64-unknown-linux-gnu --disable-cc-lowering -o - | FileCheck %s -check-prefix=LLVM
-
-!u32i = !cir.int<u, 32>
-!s32i = !cir.int<s, 32>
-
-module {
- cir.func @test_add_u32_u32_u32(%lhs: !u32i, %rhs: !u32i, %res: !cir.ptr<!u32i>) -> !cir.bool {
- %result, %overflow = cir.binop.overflow(add, %lhs, %rhs) : !u32i, (!u32i, !cir.bool)
- cir.store %result, %res : !u32i, !cir.ptr<!u32i>
- cir.return %overflow : !cir.bool
- }
-
- // MLIR: llvm.func @test_add_u32_u32_u32(%[[LHS:.+]]: i32, %[[RHS:.+]]: i32, %[[RES_PTR:.+]]: !llvm.ptr) -> i1
- // MLIR-NEXT: %[[#INTRIN_RET:]] = llvm.call_intrinsic "llvm.uadd.with.overflow.i32"(%[[LHS]], %[[RHS]]) : (i32, i32) -> !llvm.struct<(i32, i1)>
- // MLIR-NEXT: %[[#RES:]] = llvm.extractvalue %[[#INTRIN_RET]][0] : !llvm.struct<(i32, i1)>
- // MLIR-NEXT: %[[#OVFL:]] = llvm.extractvalue %[[#INTRIN_RET]][1] : !llvm.struct<(i32, i1)>
- // MLIR-NEXT: llvm.store %[[#RES]], %[[RES_PTR]] {{.*}} : i32, !llvm.ptr
- // MLIR-NEXT: llvm.return %[[#OVFL]] : i1
- // MLIR-NEXT: }
-
- // LLVM: define i1 @test_add_u32_u32_u32(i32 %[[#LHS:]], i32 %[[#RHS:]], ptr %[[#RES_PTR:]])
- // LLVM-NEXT: %[[#INTRIN_RET:]] = call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 %[[#LHS]], i32 %[[#RHS]])
- // LLVM-NEXT: %[[#RES:]] = extractvalue { i32, i1 } %[[#INTRIN_RET]], 0
- // LLVM-NEXT: %[[#OVFL:]] = extractvalue { i32, i1 } %[[#INTRIN_RET]], 1
- // LLVM-NEXT: store i32 %[[#RES]], ptr %[[#RES_PTR]], align 4
- // LLVM-NEXT: ret i1 %[[#OVFL]]
- // LLVM-NEXT: }
-
- cir.func @test_add_u32_u32_i32(%lhs: !u32i, %rhs: !u32i, %res: !cir.ptr<!s32i>) -> !cir.bool {
- %result, %overflow = cir.binop.overflow(add, %lhs, %rhs) : !u32i, (!s32i, !cir.bool)
- cir.store %result, %res : !s32i, !cir.ptr<!s32i>
- cir.return %overflow : !cir.bool
- }
-
- // MLIR: llvm.func @test_add_u32_u32_i32(%[[LHS:.+]]: i32, %[[RHS:.+]]: i32, %[[RES_PTR:.+]]: !llvm.ptr) -> i1
- // MLIR-NEXT: %[[#LHS_EXT:]] = llvm.zext %[[LHS]] : i32 to i33
- // MLIR-NEXT: %[[#RHS_EXT:]] = llvm.zext %[[RHS]] : i32 to i33
- // MLIR-NEXT: %[[#INTRIN_RET:]] = llvm.call_intrinsic "llvm.sadd.with.overflow.i33"(%[[#LHS_EXT]], %[[#RHS_EXT]]) : (i33, i33) -> !llvm.struct<(i33, i1)>
- // MLIR-NEXT: %[[#RES_EXT:]] = llvm.extractvalue %[[#INTRIN_RET]][0] : !llvm.struct<(i33, i1)>
- // MLIR-NEXT: %[[#ARITH_OVFL:]] = llvm.extractvalue %[[#INTRIN_RET]][1] : !llvm.struct<(i33, i1)>
- // MLIR-NEXT: %[[#RES:]] = llvm.trunc %[[#RES_EXT]] : i33 to i32
- // MLIR-NEXT: %[[#RES_EXT_2:]] = llvm.sext %[[#RES]] : i32 to i33
- // MLIR-NEXT: %[[#TRUNC_OVFL:]] = llvm.icmp "ne" %[[#RES_EXT_2]], %[[#RES_EXT]] : i33
- // MLIR-NEXT: %[[#OVFL:]] = llvm.or %[[#ARITH_OVFL]], %[[#TRUNC_OVFL]] : i1
- // MLIR-NEXT: llvm.store %[[#RES]], %[[RES_PTR]] {{.*}} : i32, !llvm.ptr
- // MLIR-NEXT: llvm.return %[[#OVFL]] : i1
- // MLIR-NEXT: }
-
- // LLVM: define i1 @test_add_u32_u32_i32(i32 %[[#LHS:]], i32 %[[#RHS:]], ptr %[[#RES_PTR:]])
- // LLVM-NEXT: %[[#LHS_EXT:]] = zext i32 %[[#LHS]] to i33
- // LLVM-NEXT: %[[#RHS_EXT:]] = zext i32 %[[#RHS]] to i33
- // LLVM-NEXT: %[[#INTRIN_RET:]] = call { i33, i1 } @llvm.sadd.with.overflow.i33(i33 %[[#LHS_EXT]], i33 %[[#RHS_EXT]])
- // LLVM-NEXT: %[[#RES_EXT:]] = extractvalue { i33, i1 } %[[#INTRIN_RET]], 0
- // LLVM-NEXT: %[[#ARITH_OVFL:]] = extractvalue { i33, i1 } %[[#INTRIN_RET]], 1
- // LLVM-NEXT: %[[#RES:]] = trunc i33 %[[#RES_EXT]] to i32
- // LLVM-NEXT: %[[#RES_EXT_2:]] = sext i32 %[[#RES]] to i33
- // LLVM-NEXT: %[[#TRUNC_OVFL:]] = icmp ne i33 %[[#RES_EXT_2]], %[[#RES_EXT]]
- // LLVM-NEXT: %[[#OVFL:]] = or i1 %[[#ARITH_OVFL]], %[[#TRUNC_OVFL]]
- // LLVM-NEXT: store i32 %[[#RES]], ptr %[[#RES_PTR]], align 4
- // LLVM-NEXT: ret i1 %[[#OVFL]]
- // LLVM-NEXT: }
-}
More information about the cfe-commits
mailing list