File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
lib/CIR/Lowering/DirectToLLVM Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -4364,8 +4364,11 @@ class CIRSignBitOpLowering : public mlir::OpConversionPattern<cir::SignBitOp> {
4364
4364
if (auto longDoubleType =
4365
4365
mlir::dyn_cast<cir::LongDoubleType>(op.getInput ().getType ())) {
4366
4366
if (mlir::isa<cir::FP80Type>(longDoubleType.getUnderlying ())) {
4367
- // see https://github.com/llvm/clangir/issues/1057
4368
- llvm_unreachable (" NYI" );
4367
+ // If the underlying type of LongDouble is FP80Type,
4368
+ // DataLayout::getTypeSizeInBits returns 128.
4369
+ // See https://github.com/llvm/clangir/issues/1057.
4370
+ // Set the width to 80 manually.
4371
+ width = 80 ;
4369
4372
}
4370
4373
}
4371
4374
auto intTy = mlir::IntegerType::get (rewriter.getContext (), width);
Original file line number Diff line number Diff line change @@ -23,3 +23,13 @@ void test_signbit_double(double val) {
23
23
// LLVM: %{{.+}} = zext i1 [[TMP2]] to i32
24
24
__builtin_signbitf (val );
25
25
}
26
+
27
+ void test_signbit_long_double (long double val ) {
28
+ // CIR: test_signbit_long_double
29
+ // LLVM: test_signbit_long_double
30
+ __builtin_signbitl (val );
31
+ // CIR: %{{.+}} = cir.signbit %{{.+}} : !cir.long_double<!cir.f80> -> !s32i
32
+ // LLVM: [[TMP1:%.*]] = bitcast x86_fp80 %{{.+}} to i80
33
+ // LLVM: [[TMP2:%.*]] = icmp slt i80 [[TMP1]], 0
34
+ // LLVM: %{{.+}} = zext i1 [[TMP2]] to i32
35
+ }
You can’t perform that action at this time.
0 commit comments