diff --git a/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h b/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h index a29fb45e95032..a841190c53c0d 100644 --- a/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h +++ b/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h @@ -702,6 +702,41 @@ class CIRBaseBuilderTy : public mlir::OpBuilder { return cir::RemOp::create(*this, loc, lhs, rhs); } + mlir::Value createFAdd(mlir::Location loc, mlir::Value lhs, mlir::Value rhs) { + assert(!cir::MissingFeatures::metaDataNode()); + assert(!cir::MissingFeatures::fpConstraints()); + assert(!cir::MissingFeatures::fastMathFlags()); + return cir::FAddOp::create(*this, loc, lhs, rhs); + } + + mlir::Value createFSub(mlir::Location loc, mlir::Value lhs, mlir::Value rhs) { + assert(!cir::MissingFeatures::metaDataNode()); + assert(!cir::MissingFeatures::fpConstraints()); + assert(!cir::MissingFeatures::fastMathFlags()); + return cir::FSubOp::create(*this, loc, lhs, rhs); + } + + mlir::Value createFMul(mlir::Location loc, mlir::Value lhs, mlir::Value rhs) { + assert(!cir::MissingFeatures::metaDataNode()); + assert(!cir::MissingFeatures::fpConstraints()); + assert(!cir::MissingFeatures::fastMathFlags()); + return cir::FMulOp::create(*this, loc, lhs, rhs); + } + + mlir::Value createFDiv(mlir::Location loc, mlir::Value lhs, mlir::Value rhs) { + assert(!cir::MissingFeatures::metaDataNode()); + assert(!cir::MissingFeatures::fpConstraints()); + assert(!cir::MissingFeatures::fastMathFlags()); + return cir::FDivOp::create(*this, loc, lhs, rhs); + } + + mlir::Value createFRem(mlir::Location loc, mlir::Value lhs, mlir::Value rhs) { + assert(!cir::MissingFeatures::metaDataNode()); + assert(!cir::MissingFeatures::fpConstraints()); + assert(!cir::MissingFeatures::fastMathFlags()); + return cir::FRemOp::create(*this, loc, lhs, rhs); + } + mlir::Value createXor(mlir::Location loc, mlir::Value lhs, mlir::Value rhs) { return cir::XorOp::create(*this, loc, lhs, rhs); } diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td index c4d08d5337031..975be5aac87a7 100644 --- a/clang/include/clang/CIR/Dialect/IR/CIROps.td +++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td @@ -2430,18 +2430,20 @@ class CIR_BinaryOpWithOverflowFlags { - let summary = "Integer or floating-point addition"; +def CIR_AddOp + : CIR_BinaryOpWithOverflowFlags<"add", CIR_AnyIntOrVecOfIntType> { + let summary = "Integer addition"; let description = [{ - The `cir.add` operation performs addition on integer or floating-point - operands. Both operands and the result must have the same type. + The `cir.add` operation performs addition on integer operands. Both + operands and the result must have the same integer or vector-of-integer + type. Floating-point addition is performed by `cir.fadd`. + + The optional `nsw` (no signed wrap) and `nuw` (no unsigned wrap) unit + attributes indicate that the result is poison if signed or unsigned + overflow occurs, respectively. The optional `sat` (saturated) attribute + clamps the result to the type's representable range instead of wrapping. + The `nsw`/`nuw` flags and `sat` are mutually exclusive. - For integer types, the optional `nsw` (no signed wrap) and `nuw` (no - unsigned wrap) unit attributes indicate that the result is poison if signed - or unsigned overflow occurs, respectively. The optional `sat` (saturated) - attribute clamps the result to the type's representable range instead of - wrapping. The `nsw`/`nuw` flags and `sat` are mutually exclusive. - Example: ``` @@ -2449,7 +2451,7 @@ def CIR_AddOp : CIR_BinaryOpWithOverflowFlags<"add", CIR_AnyArithType> { %1 = cir.add nsw %a, %b : !s32i %2 = cir.add nuw %a, %b : !u32i %3 = cir.add sat %a, %b : !s32i - %4 = cir.add %a, %b : !cir.float + %4 = cir.add %va, %vb : !cir.vector<4 x !s32i> ``` }]; } @@ -2458,25 +2460,27 @@ def CIR_AddOp : CIR_BinaryOpWithOverflowFlags<"add", CIR_AnyArithType> { // SubOp //===----------------------------------------------------------------------===// -def CIR_SubOp : CIR_BinaryOpWithOverflowFlags<"sub", CIR_AnyArithType> { - let summary = "Integer or floating-point subtraction"; +def CIR_SubOp + : CIR_BinaryOpWithOverflowFlags<"sub", CIR_AnyIntOrVecOfIntType> { + let summary = "Integer subtraction"; let description = [{ - The `cir.sub` operation performs subtraction on integer or floating-point - operands. Both operands and the result must have the same type. + The `cir.sub` operation performs subtraction on integer operands. Both + operands and the result must have the same integer or vector-of-integer + type. Floating-point subtraction is performed by `cir.fsub`. + + The optional `nsw` (no signed wrap) and `nuw` (no unsigned wrap) unit + attributes indicate that the result is poison if signed or unsigned + overflow occurs, respectively. The optional `sat` (saturated) attribute + clamps the result to the type's representable range. The `nsw`/`nuw` + flags and `sat` are mutually exclusive. - For integer types, the optional `nsw` (no signed wrap) and `nuw` (no - unsigned wrap) unit attributes indicate that the result is poison if signed - or unsigned overflow occurs, respectively. The optional `sat` (saturated) - attribute clamps the result to the type's representable range. The - `nsw`/`nuw` flags and `sat` are mutually exclusive. - Example: ``` %0 = cir.sub %a, %b : !s32i %1 = cir.sub nsw %a, %b : !s32i %2 = cir.sub sat %a, %b : !s32i - %3 = cir.sub %a, %b : !cir.float + %3 = cir.sub %va, %vb : !cir.vector<4 x !s32i> ``` }]; } @@ -2485,15 +2489,16 @@ def CIR_SubOp : CIR_BinaryOpWithOverflowFlags<"sub", CIR_AnyArithType> { // MulOp //===----------------------------------------------------------------------===// -def CIR_MulOp : CIR_BinaryOp<"mul", CIR_AnyArithType> { - let summary = "Integer or floating-point multiplication"; +def CIR_MulOp : CIR_BinaryOp<"mul", CIR_AnyIntOrVecOfIntType> { + let summary = "Integer multiplication"; let description = [{ - The `cir.mul` operation performs multiplication on integer or floating-point - operands. Both operands and the result must have the same type. + The `cir.mul` operation performs multiplication on integer operands. Both + operands and the result must have the same integer or vector-of-integer + type. Floating-point multiplication is performed by `cir.fmul`. - For integer types, the optional `nsw` (no signed wrap) and `nuw` (no - unsigned wrap) unit attributes indicate that the result is poison if signed - or unsigned overflow occurs, respectively. + The optional `nsw` (no signed wrap) and `nuw` (no unsigned wrap) unit + attributes indicate that the result is poison if signed or unsigned + overflow occurs, respectively. Example: @@ -2501,12 +2506,12 @@ def CIR_MulOp : CIR_BinaryOp<"mul", CIR_AnyArithType> { %0 = cir.mul %a, %b : !s32i %1 = cir.mul nsw %a, %b : !s32i %2 = cir.mul nuw %a, %b : !u32i - %3 = cir.mul %a, %b : !cir.float + %3 = cir.mul %va, %vb : !cir.vector<4 x !s32i> ``` }]; - + let arguments = (ins - CIR_AnyArithType:$lhs, CIR_AnyArithType:$rhs, + CIR_AnyIntOrVecOfIntType:$lhs, CIR_AnyIntOrVecOfIntType:$rhs, UnitProp:$no_signed_wrap, UnitProp:$no_unsigned_wrap ); @@ -2516,26 +2521,25 @@ def CIR_MulOp : CIR_BinaryOp<"mul", CIR_AnyArithType> { (`nuw` $no_unsigned_wrap^)? $lhs `,` $rhs `:` type($lhs) attr-dict }]; - - let hasVerifier = 1; } //===----------------------------------------------------------------------===// // DivOp //===----------------------------------------------------------------------===// -def CIR_DivOp : CIR_BinaryOp<"div", CIR_AnyArithType> { - let summary = "Integer or floating-point division"; +def CIR_DivOp : CIR_BinaryOp<"div", CIR_AnyIntOrVecOfIntType> { + let summary = "Integer division"; let description = [{ - The `cir.div` operation performs division on integer or floating-point - operands. Both operands and the result must have the same type. + The `cir.div` operation performs division on integer operands. Both + operands and the result must have the same integer or vector-of-integer + type. Example: ``` %0 = cir.div %a, %b : !s32i %1 = cir.div %a, %b : !u32i - %2 = cir.div %a, %b : !cir.float + %2 = cir.div %va, %vb : !cir.vector<4 x !s32i> ``` }]; } @@ -2544,21 +2548,146 @@ def CIR_DivOp : CIR_BinaryOp<"div", CIR_AnyArithType> { // RemOp //===----------------------------------------------------------------------===// -def CIR_RemOp : CIR_BinaryOp<"rem", CIR_AnyArithType> { - let summary = "Integer or floating-point remainder"; +def CIR_RemOp : CIR_BinaryOp<"rem", CIR_AnyIntOrVecOfIntType> { + let summary = "Integer remainder"; let description = [{ - The `cir.rem` operation computes the remainder of division on integer or - floating-point operands. Both operands and the result must have the same - type. - + The `cir.rem` operation computes the remainder of division on integer + operands. Both operands and the result must have the same integer or + vector-of-integer type. + Example: ``` %0 = cir.rem %a, %b : !s32i %1 = cir.rem %a, %b : !u32i - %2 = cir.rem %a, %b : !cir.float + %2 = cir.rem %va, %vb : !cir.vector<4 x !s32i> + ``` + }]; +} + +//===----------------------------------------------------------------------===// +// Floating-Point Binary Arithmetic Operations +//===----------------------------------------------------------------------===// + +// Base class for floating-point binary arithmetic operations. The lhs, rhs, +// and result must all be the same floating-point scalar or vector type. +class CIR_FPBinaryOp traits = []> + : CIR_BinaryOp; + +//===----------------------------------------------------------------------===// +// FAddOp +//===----------------------------------------------------------------------===// + +def CIR_FAddOp : CIR_FPBinaryOp<"fadd"> { + let summary = "Floating-point addition"; + let description = [{ + The `cir.fadd` operation performs floating-point addition on its operands. + Both operands and the result must have the same floating-point scalar or + vector-of-float type. + + Example: + + ``` + %0 = cir.fadd %a, %b : !cir.float + %1 = cir.fadd %a, %b : !cir.double + %2 = cir.fadd %va, %vb : !cir.vector<4 x !cir.float> + ``` + }]; + + let llvmOp = "FAddOp"; +} + +//===----------------------------------------------------------------------===// +// FSubOp +//===----------------------------------------------------------------------===// + +def CIR_FSubOp : CIR_FPBinaryOp<"fsub"> { + let summary = "Floating-point subtraction"; + let description = [{ + The `cir.fsub` operation performs floating-point subtraction on its + operands. Both operands and the result must have the same floating-point + scalar or vector-of-float type. + + Example: + + ``` + %0 = cir.fsub %a, %b : !cir.float + %1 = cir.fsub %a, %b : !cir.double + %2 = cir.fsub %va, %vb : !cir.vector<4 x !cir.float> ``` }]; + + let llvmOp = "FSubOp"; +} + +//===----------------------------------------------------------------------===// +// FMulOp +//===----------------------------------------------------------------------===// + +def CIR_FMulOp : CIR_FPBinaryOp<"fmul"> { + let summary = "Floating-point multiplication"; + let description = [{ + The `cir.fmul` operation performs floating-point multiplication on its + operands. Both operands and the result must have the same floating-point + scalar or vector-of-float type. + + Example: + + ``` + %0 = cir.fmul %a, %b : !cir.float + %1 = cir.fmul %a, %b : !cir.double + %2 = cir.fmul %va, %vb : !cir.vector<4 x !cir.float> + ``` + }]; + + let llvmOp = "FMulOp"; +} + +//===----------------------------------------------------------------------===// +// FDivOp +//===----------------------------------------------------------------------===// + +def CIR_FDivOp : CIR_FPBinaryOp<"fdiv"> { + let summary = "Floating-point division"; + let description = [{ + The `cir.fdiv` operation performs floating-point division on its operands. + Both operands and the result must have the same floating-point scalar or + vector-of-float type. + + Example: + + ``` + %0 = cir.fdiv %a, %b : !cir.float + %1 = cir.fdiv %a, %b : !cir.double + %2 = cir.fdiv %va, %vb : !cir.vector<4 x !cir.float> + ``` + }]; + + let llvmOp = "FDivOp"; +} + +//===----------------------------------------------------------------------===// +// FRemOp +//===----------------------------------------------------------------------===// + +def CIR_FRemOp : CIR_FPBinaryOp<"frem"> { + let summary = "Floating-point remainder"; + let description = [{ + The `cir.frem` operation computes the floating-point remainder of its + operands. Both operands and the result must have the same floating-point + scalar or vector-of-float type. + + Example: + + ``` + %0 = cir.frem %a, %b : !cir.float + %1 = cir.frem %a, %b : !cir.double + %2 = cir.frem %va, %vb : !cir.vector<4 x !cir.float> + ``` + }]; + + let llvmOp = "FRemOp"; } //===----------------------------------------------------------------------===// diff --git a/clang/include/clang/CIR/Dialect/IR/CIRTypeConstraints.td b/clang/include/clang/CIR/Dialect/IR/CIRTypeConstraints.td index 3cc79b9796e06..322eec853d821 100644 --- a/clang/include/clang/CIR/Dialect/IR/CIRTypeConstraints.td +++ b/clang/include/clang/CIR/Dialect/IR/CIRTypeConstraints.td @@ -342,13 +342,6 @@ def CIR_AnyFloatOrVecOfFloatType let cppFunctionName = "isFPOrVectorOfFPType"; } -// Types valid for arithmetic ops (add/sub/mul/div/rem): -// scalar or vector of integer or floating-point. -def CIR_AnyArithType - : AnyTypeOf<[CIR_AnyIntType, CIR_AnyFloatType, - CIR_VectorOfIntType, CIR_VectorOfFloatType], - "integer, floating-point, or vector of integer/float">; - // Types valid for bitwise ops (and/or/xor): // integer, boolean, or vector of integer (no floating-point). def CIR_AnyBitwiseType diff --git a/clang/lib/CIR/CodeGen/CIRGenBuilder.h b/clang/lib/CIR/CodeGen/CIRGenBuilder.h index 6e0f4ce00d4f1..9e88e3588d84a 100644 --- a/clang/lib/CIR/CodeGen/CIRGenBuilder.h +++ b/clang/lib/CIR/CodeGen/CIRGenBuilder.h @@ -490,40 +490,6 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy { return createMinus(value.getLoc(), value); } - //===--------------------------------------------------------------------===// - // BinaryOp creation helpers - //===--------------------------------------------------------------------===// - mlir::Value createFSub(mlir::Location loc, mlir::Value lhs, mlir::Value rhs) { - assert(!cir::MissingFeatures::metaDataNode()); - assert(!cir::MissingFeatures::fpConstraints()); - assert(!cir::MissingFeatures::fastMathFlags()); - - return cir::SubOp::create(*this, loc, lhs, rhs); - } - - mlir::Value createFAdd(mlir::Location loc, mlir::Value lhs, mlir::Value rhs) { - assert(!cir::MissingFeatures::metaDataNode()); - assert(!cir::MissingFeatures::fpConstraints()); - assert(!cir::MissingFeatures::fastMathFlags()); - - return cir::AddOp::create(*this, loc, lhs, rhs); - } - - mlir::Value createFMul(mlir::Location loc, mlir::Value lhs, mlir::Value rhs) { - assert(!cir::MissingFeatures::metaDataNode()); - assert(!cir::MissingFeatures::fpConstraints()); - assert(!cir::MissingFeatures::fastMathFlags()); - - return cir::MulOp::create(*this, loc, lhs, rhs); - } - mlir::Value createFDiv(mlir::Location loc, mlir::Value lhs, mlir::Value rhs) { - assert(!cir::MissingFeatures::metaDataNode()); - assert(!cir::MissingFeatures::fpConstraints()); - assert(!cir::MissingFeatures::fastMathFlags()); - - return cir::DivOp::create(*this, loc, lhs, rhs); - } - //===--------------------------------------------------------------------===// // CastOp creation helpers //===--------------------------------------------------------------------===// diff --git a/clang/lib/CIR/CodeGen/CIRGenExprComplex.cpp b/clang/lib/CIR/CodeGen/CIRGenExprComplex.cpp index c576cb9159f36..5f35b32336e33 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExprComplex.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExprComplex.cpp @@ -606,17 +606,23 @@ mlir::Value ComplexExprEmitter::emitBinAdd(const BinOpInfo &op) { mlir::isa(op.rhs.getType())) return cir::ComplexAddOp::create(builder, op.loc, op.lhs, op.rhs); + auto createAdd = [&](mlir::Location loc, mlir::Value a, mlir::Value b) { + return cir::isFPOrVectorOfFPType(a.getType()) + ? builder.createFAdd(loc, a, b) + : builder.createAdd(loc, a, b); + }; + if (mlir::isa(op.lhs.getType())) { mlir::Value real = builder.createComplexReal(op.loc, op.lhs); mlir::Value imag = builder.createComplexImag(op.loc, op.lhs); - mlir::Value newReal = builder.createAdd(op.loc, real, op.rhs); + mlir::Value newReal = createAdd(op.loc, real, op.rhs); return builder.createComplexCreate(op.loc, newReal, imag); } assert(mlir::isa(op.rhs.getType())); mlir::Value real = builder.createComplexReal(op.loc, op.rhs); mlir::Value imag = builder.createComplexImag(op.loc, op.rhs); - mlir::Value newReal = builder.createAdd(op.loc, op.lhs, real); + mlir::Value newReal = createAdd(op.loc, op.lhs, real); return builder.createComplexCreate(op.loc, newReal, imag); } @@ -628,17 +634,23 @@ mlir::Value ComplexExprEmitter::emitBinSub(const BinOpInfo &op) { mlir::isa(op.rhs.getType())) return cir::ComplexSubOp::create(builder, op.loc, op.lhs, op.rhs); + auto createSub = [&](mlir::Location loc, mlir::Value a, mlir::Value b) { + return cir::isFPOrVectorOfFPType(a.getType()) + ? builder.createFSub(loc, a, b) + : builder.createSub(loc, a, b); + }; + if (mlir::isa(op.lhs.getType())) { mlir::Value real = builder.createComplexReal(op.loc, op.lhs); mlir::Value imag = builder.createComplexImag(op.loc, op.lhs); - mlir::Value newReal = builder.createSub(op.loc, real, op.rhs); + mlir::Value newReal = createSub(op.loc, real, op.rhs); return builder.createComplexCreate(op.loc, newReal, imag); } assert(mlir::isa(op.rhs.getType())); mlir::Value real = builder.createComplexReal(op.loc, op.rhs); mlir::Value imag = builder.createComplexImag(op.loc, op.rhs); - mlir::Value newReal = builder.createSub(op.loc, op.lhs, real); + mlir::Value newReal = createSub(op.loc, op.lhs, real); return builder.createComplexCreate(op.loc, newReal, imag); } @@ -671,19 +683,25 @@ mlir::Value ComplexExprEmitter::emitBinMul(const BinOpInfo &op) { rangeKind); } + auto createMul = [&](mlir::Location loc, mlir::Value a, mlir::Value b) { + return cir::isFPOrVectorOfFPType(a.getType()) + ? builder.createFMul(loc, a, b) + : builder.createMul(loc, a, b); + }; + if (mlir::isa(op.lhs.getType())) { mlir::Value real = builder.createComplexReal(op.loc, op.lhs); mlir::Value imag = builder.createComplexImag(op.loc, op.lhs); - mlir::Value newReal = builder.createMul(op.loc, real, op.rhs); - mlir::Value newImag = builder.createMul(op.loc, imag, op.rhs); + mlir::Value newReal = createMul(op.loc, real, op.rhs); + mlir::Value newImag = createMul(op.loc, imag, op.rhs); return builder.createComplexCreate(op.loc, newReal, newImag); } assert(mlir::isa(op.rhs.getType())); mlir::Value real = builder.createComplexReal(op.loc, op.rhs); mlir::Value imag = builder.createComplexImag(op.loc, op.rhs); - mlir::Value newReal = builder.createMul(op.loc, op.lhs, real); - mlir::Value newImag = builder.createMul(op.loc, op.lhs, imag); + mlir::Value newReal = createMul(op.loc, op.lhs, real); + mlir::Value newImag = createMul(op.loc, op.lhs, imag); return builder.createComplexCreate(op.loc, newReal, newImag); } diff --git a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp index 47dedd4e4cf0c..5f2626da19a34 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp @@ -1990,12 +1990,22 @@ mlir::Value ScalarExprEmitter::emitMul(const BinOpInfo &ops) { cgf.convertType(ops.fullType), ops.lhs, ops.rhs); } mlir::Value ScalarExprEmitter::emitDiv(const BinOpInfo &ops) { - return cir::DivOp::create(builder, cgf.getLoc(ops.loc), - cgf.convertType(ops.fullType), ops.lhs, ops.rhs); + const mlir::Location loc = cgf.getLoc(ops.loc); + if (cir::isFPOrVectorOfFPType(ops.lhs.getType())) { + CIRGenFunction::CIRGenFPOptionsRAII FPOptsRAII(cgf, ops.fpFeatures); + return builder.createFDiv(loc, ops.lhs, ops.rhs); + } + return cir::DivOp::create(builder, loc, cgf.convertType(ops.fullType), + ops.lhs, ops.rhs); } mlir::Value ScalarExprEmitter::emitRem(const BinOpInfo &ops) { - return cir::RemOp::create(builder, cgf.getLoc(ops.loc), - cgf.convertType(ops.fullType), ops.lhs, ops.rhs); + const mlir::Location loc = cgf.getLoc(ops.loc); + if (cir::isFPOrVectorOfFPType(ops.lhs.getType())) { + CIRGenFunction::CIRGenFPOptionsRAII FPOptsRAII(cgf, ops.fpFeatures); + return builder.createFRem(loc, ops.lhs, ops.rhs); + } + return cir::RemOp::create(builder, loc, cgf.convertType(ops.fullType), + ops.lhs, ops.rhs); } mlir::Value ScalarExprEmitter::emitAdd(const BinOpInfo &ops) { diff --git a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp index cf07fc4f0833a..371806a216dcc 100644 --- a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp +++ b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp @@ -2819,42 +2819,25 @@ mlir::LogicalResult cir::FuncOp::verify() { } //===----------------------------------------------------------------------===// -// AddOp / SubOp / MulOp -//===----------------------------------------------------------------------===// - -static LogicalResult verifyBinaryOverflowOp(mlir::Operation *op, - bool noSignedWrap, - bool noUnsignedWrap, bool saturated, - bool hasSat) { - bool noWrap = noSignedWrap || noUnsignedWrap; - if (!isa(op->getResultTypes()[0]) && noWrap) - return op->emitError() - << "only operations on integer values may have nsw/nuw flags"; - if (hasSat && saturated && !isa(op->getResultTypes()[0])) - return op->emitError() - << "only operations on integer values may have sat flag"; - if (hasSat && noWrap && saturated) - return op->emitError() - << "the nsw/nuw flags and the saturated flag are mutually exclusive"; - return mlir::success(); -} +// AddOp / SubOp +//===----------------------------------------------------------------------===// + +// The integer-only type constraint on these ops makes the nsw/nuw/sat flag +// type checks unnecessary. Only the mutual-exclusivity between nsw/nuw and +// sat needs to be verified. LogicalResult cir::AddOp::verify() { - return verifyBinaryOverflowOp(getOperation(), getNoSignedWrap(), - getNoUnsignedWrap(), getSaturated(), - /*hasSat=*/true); + if (getSaturated() && (getNoSignedWrap() || getNoUnsignedWrap())) + return emitOpError() + << "the nsw/nuw flags and the saturated flag are mutually exclusive"; + return mlir::success(); } LogicalResult cir::SubOp::verify() { - return verifyBinaryOverflowOp(getOperation(), getNoSignedWrap(), - getNoUnsignedWrap(), getSaturated(), - /*hasSat=*/true); -} - -LogicalResult cir::MulOp::verify() { - return verifyBinaryOverflowOp(getOperation(), getNoSignedWrap(), - getNoUnsignedWrap(), /*saturated=*/false, - /*hasSat=*/false); + if (getSaturated() && (getNoSignedWrap() || getNoUnsignedWrap())) + return emitOpError() + << "the nsw/nuw flags and the saturated flag are mutually exclusive"; + return mlir::success(); } //===----------------------------------------------------------------------===// diff --git a/clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp b/clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp index cb10b695f73e7..14458d5b62d67 100644 --- a/clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp +++ b/clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp @@ -683,18 +683,34 @@ buildAlgebraicComplexDiv(CIRBaseBuilderTy &builder, mlir::Location loc, mlir::Value &c = rhsReal; mlir::Value &d = rhsImag; - mlir::Value ac = builder.createMul(loc, a, c); // a*c - mlir::Value bd = builder.createMul(loc, b, d); // b*d - mlir::Value cc = builder.createMul(loc, c, c); // c*c - mlir::Value dd = builder.createMul(loc, d, d); // d*d - mlir::Value acbd = builder.createAdd(loc, ac, bd); // ac+bd - mlir::Value ccdd = builder.createAdd(loc, cc, dd); // cc+dd - mlir::Value resultReal = builder.createDiv(loc, acbd, ccdd); - - mlir::Value bc = builder.createMul(loc, b, c); // b*c - mlir::Value ad = builder.createMul(loc, a, d); // a*d - mlir::Value bcad = builder.createSub(loc, bc, ad); // bc-ad - mlir::Value resultImag = builder.createDiv(loc, bcad, ccdd); + // The element type of the complex (lhs/rhs) determines whether floating + // point or integer ops are needed. + bool isFP = cir::isFPOrVectorOfFPType(a.getType()); + auto mul = [&](mlir::Location l, mlir::Value x, mlir::Value y) { + return isFP ? builder.createFMul(l, x, y) : builder.createMul(l, x, y); + }; + auto add = [&](mlir::Location l, mlir::Value x, mlir::Value y) { + return isFP ? builder.createFAdd(l, x, y) : builder.createAdd(l, x, y); + }; + auto sub = [&](mlir::Location l, mlir::Value x, mlir::Value y) { + return isFP ? builder.createFSub(l, x, y) : builder.createSub(l, x, y); + }; + auto div = [&](mlir::Location l, mlir::Value x, mlir::Value y) { + return isFP ? builder.createFDiv(l, x, y) : builder.createDiv(l, x, y); + }; + + mlir::Value ac = mul(loc, a, c); // a*c + mlir::Value bd = mul(loc, b, d); // b*d + mlir::Value cc = mul(loc, c, c); // c*c + mlir::Value dd = mul(loc, d, d); // d*d + mlir::Value acbd = add(loc, ac, bd); // ac+bd + mlir::Value ccdd = add(loc, cc, dd); // cc+dd + mlir::Value resultReal = div(loc, acbd, ccdd); + + mlir::Value bc = mul(loc, b, c); // b*c + mlir::Value ad = mul(loc, a, d); // a*d + mlir::Value bcad = sub(loc, bc, ad); // bc-ad + mlir::Value resultImag = div(loc, bcad, ccdd); return builder.createComplexCreate(loc, resultReal, resultImag); } @@ -727,35 +743,39 @@ buildRangeReductionComplexDiv(CIRBaseBuilderTy &builder, mlir::Location loc, mlir::Value &c = rhsReal; mlir::Value &d = rhsImag; + // Smith's algorithm is only used for floating-point complex division. + assert(cir::isFPOrVectorOfFPType(a.getType()) && + "range-reduction complex divide expects floating-point operands"); + auto trueBranchBuilder = [&](mlir::OpBuilder &, mlir::Location) { - mlir::Value r = builder.createDiv(loc, d, c); // r := d / c - mlir::Value rd = builder.createMul(loc, r, d); // r*d - mlir::Value tmp = builder.createAdd(loc, c, rd); // tmp := c + r*d + mlir::Value r = builder.createFDiv(loc, d, c); // r := d / c + mlir::Value rd = builder.createFMul(loc, r, d); // r*d + mlir::Value tmp = builder.createFAdd(loc, c, rd); // tmp := c + r*d - mlir::Value br = builder.createMul(loc, b, r); // b*r - mlir::Value abr = builder.createAdd(loc, a, br); // a + b*r - mlir::Value e = builder.createDiv(loc, abr, tmp); + mlir::Value br = builder.createFMul(loc, b, r); // b*r + mlir::Value abr = builder.createFAdd(loc, a, br); // a + b*r + mlir::Value e = builder.createFDiv(loc, abr, tmp); - mlir::Value ar = builder.createMul(loc, a, r); // a*r - mlir::Value bar = builder.createSub(loc, b, ar); // b - a*r - mlir::Value f = builder.createDiv(loc, bar, tmp); + mlir::Value ar = builder.createFMul(loc, a, r); // a*r + mlir::Value bar = builder.createFSub(loc, b, ar); // b - a*r + mlir::Value f = builder.createFDiv(loc, bar, tmp); mlir::Value result = builder.createComplexCreate(loc, e, f); builder.createYield(loc, result); }; auto falseBranchBuilder = [&](mlir::OpBuilder &, mlir::Location) { - mlir::Value r = builder.createDiv(loc, c, d); // r := c / d - mlir::Value rc = builder.createMul(loc, r, c); // r*c - mlir::Value tmp = builder.createAdd(loc, d, rc); // tmp := d + r*c + mlir::Value r = builder.createFDiv(loc, c, d); // r := c / d + mlir::Value rc = builder.createFMul(loc, r, c); // r*c + mlir::Value tmp = builder.createFAdd(loc, d, rc); // tmp := d + r*c - mlir::Value ar = builder.createMul(loc, a, r); // a*r - mlir::Value arb = builder.createAdd(loc, ar, b); // a*r + b - mlir::Value e = builder.createDiv(loc, arb, tmp); + mlir::Value ar = builder.createFMul(loc, a, r); // a*r + mlir::Value arb = builder.createFAdd(loc, ar, b); // a*r + b + mlir::Value e = builder.createFDiv(loc, arb, tmp); - mlir::Value br = builder.createMul(loc, b, r); // b*r - mlir::Value bra = builder.createSub(loc, br, a); // b*r - a - mlir::Value f = builder.createDiv(loc, bra, tmp); + mlir::Value br = builder.createFMul(loc, b, r); // b*r + mlir::Value bra = builder.createFSub(loc, br, a); // b*r - a + mlir::Value f = builder.createFDiv(loc, bra, tmp); mlir::Value result = builder.createComplexCreate(loc, e, f); builder.createYield(loc, result); @@ -940,12 +960,23 @@ static mlir::Value lowerComplexMul(LoweringPreparePass &pass, mlir::Value lhsReal, mlir::Value lhsImag, mlir::Value rhsReal, mlir::Value rhsImag) { // (a+bi) * (c+di) = (ac-bd) + (ad+bc)i - mlir::Value resultRealLhs = builder.createMul(loc, lhsReal, rhsReal); // ac - mlir::Value resultRealRhs = builder.createMul(loc, lhsImag, rhsImag); // bd - mlir::Value resultImagLhs = builder.createMul(loc, lhsReal, rhsImag); // ad - mlir::Value resultImagRhs = builder.createMul(loc, lhsImag, rhsReal); // bc - mlir::Value resultReal = builder.createSub(loc, resultRealLhs, resultRealRhs); - mlir::Value resultImag = builder.createAdd(loc, resultImagLhs, resultImagRhs); + bool isFP = cir::isFPOrVectorOfFPType(lhsReal.getType()); + auto mul = [&](mlir::Location l, mlir::Value x, mlir::Value y) { + return isFP ? builder.createFMul(l, x, y) : builder.createMul(l, x, y); + }; + auto add = [&](mlir::Location l, mlir::Value x, mlir::Value y) { + return isFP ? builder.createFAdd(l, x, y) : builder.createAdd(l, x, y); + }; + auto sub = [&](mlir::Location l, mlir::Value x, mlir::Value y) { + return isFP ? builder.createFSub(l, x, y) : builder.createSub(l, x, y); + }; + + mlir::Value resultRealLhs = mul(loc, lhsReal, rhsReal); // ac + mlir::Value resultRealRhs = mul(loc, lhsImag, rhsImag); // bd + mlir::Value resultImagLhs = mul(loc, lhsReal, rhsImag); // ad + mlir::Value resultImagRhs = mul(loc, lhsImag, rhsReal); // bc + mlir::Value resultReal = sub(loc, resultRealLhs, resultRealRhs); + mlir::Value resultImag = add(loc, resultImagLhs, resultImagRhs); mlir::Value algebraicResult = builder.createComplexCreate(loc, resultReal, resultImag); diff --git a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp index 8c7e1406d6567..be2eb6972294f 100644 --- a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp +++ b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp @@ -2705,25 +2705,23 @@ static mlir::LLVM::IntegerOverflowFlags intOverflowFlag(BinOp op) { } /// Lower an arithmetic op that supports saturation, overflow flags, and an FP -/// variant. Used for Add and Sub which share identical dispatch logic. -template static mlir::LogicalResult lowerSaturatableArithOp(CIROp op, mlir::Value lhs, mlir::Value rhs, mlir::ConversionPatternRewriter &rewriter) { const mlir::Type eltType = elementTypeIfVector(op.getRhs().getType()); - if (cir::isIntOrBoolType(eltType)) { - if (op.getSaturated()) { - if (isIntTypeUnsigned(eltType)) - rewriter.replaceOpWithNewOp(op, lhs, rhs); - else - rewriter.replaceOpWithNewOp(op, lhs, rhs); - return mlir::success(); - } - rewriter.replaceOpWithNewOp(op, lhs, rhs, intOverflowFlag(op)); - } else { - rewriter.replaceOpWithNewOp(op, lhs, rhs); + assert(cir::isIntOrBoolType(eltType) && + "saturatable arith op expects integer operand types"); + if (op.getSaturated()) { + if (isIntTypeUnsigned(eltType)) + rewriter.replaceOpWithNewOp(op, lhs, rhs); + else + rewriter.replaceOpWithNewOp(op, lhs, rhs); + return mlir::success(); } + rewriter.replaceOpWithNewOp(op, lhs, rhs, intOverflowFlag(op)); return mlir::success(); } @@ -2731,64 +2729,55 @@ mlir::LogicalResult CIRToLLVMAddOpLowering::matchAndRewrite( cir::AddOp op, OpAdaptor adaptor, mlir::ConversionPatternRewriter &rewriter) const { return lowerSaturatableArithOp( - op, adaptor.getLhs(), adaptor.getRhs(), rewriter); + mlir::LLVM::AddOp>(op, adaptor.getLhs(), + adaptor.getRhs(), rewriter); } mlir::LogicalResult CIRToLLVMSubOpLowering::matchAndRewrite( cir::SubOp op, OpAdaptor adaptor, mlir::ConversionPatternRewriter &rewriter) const { return lowerSaturatableArithOp( - op, adaptor.getLhs(), adaptor.getRhs(), rewriter); + mlir::LLVM::SubOp>(op, adaptor.getLhs(), + adaptor.getRhs(), rewriter); } mlir::LogicalResult CIRToLLVMMulOpLowering::matchAndRewrite( cir::MulOp op, OpAdaptor adaptor, mlir::ConversionPatternRewriter &rewriter) const { - const mlir::Value lhs = adaptor.getLhs(); - const mlir::Value rhs = adaptor.getRhs(); - if (cir::isIntOrBoolType(elementTypeIfVector(op.getRhs().getType()))) { - rewriter.replaceOpWithNewOp(op, lhs, rhs, - intOverflowFlag(op)); - } else { - rewriter.replaceOpWithNewOp(op, lhs, rhs); - } + assert(cir::isIntOrBoolType(elementTypeIfVector(op.getRhs().getType())) && + "cir.mul expects integer operand types"); + rewriter.replaceOpWithNewOp( + op, adaptor.getLhs(), adaptor.getRhs(), intOverflowFlag(op)); return mlir::success(); } -/// Lower a binary op that maps to unsigned/signed/FP LLVM ops depending on -/// operand type. Used for Div and Rem which share identical dispatch logic. -template +/// Lower an integer Div/Rem op to its signed or unsigned LLVM counterpart. +template static mlir::LogicalResult -lowerIntFPBinaryOp(CIROp op, mlir::Value lhs, mlir::Value rhs, - mlir::ConversionPatternRewriter &rewriter) { +lowerIntBinaryOp(CIROp op, mlir::Value lhs, mlir::Value rhs, + mlir::ConversionPatternRewriter &rewriter) { const mlir::Type eltType = elementTypeIfVector(op.getRhs().getType()); - if (cir::isIntOrBoolType(eltType)) { - if (isIntTypeUnsigned(eltType)) - rewriter.replaceOpWithNewOp(op, lhs, rhs); - else - rewriter.replaceOpWithNewOp(op, lhs, rhs); - } else { - rewriter.replaceOpWithNewOp(op, lhs, rhs); - } + assert(cir::isIntOrBoolType(eltType) && + "integer binary op expects integer operand types"); + if (isIntTypeUnsigned(eltType)) + rewriter.replaceOpWithNewOp(op, lhs, rhs); + else + rewriter.replaceOpWithNewOp(op, lhs, rhs); return mlir::success(); } mlir::LogicalResult CIRToLLVMDivOpLowering::matchAndRewrite( cir::DivOp op, OpAdaptor adaptor, mlir::ConversionPatternRewriter &rewriter) const { - return lowerIntFPBinaryOp(op, adaptor.getLhs(), - adaptor.getRhs(), rewriter); + return lowerIntBinaryOp( + op, adaptor.getLhs(), adaptor.getRhs(), rewriter); } mlir::LogicalResult CIRToLLVMRemOpLowering::matchAndRewrite( cir::RemOp op, OpAdaptor adaptor, mlir::ConversionPatternRewriter &rewriter) const { - return lowerIntFPBinaryOp(op, adaptor.getLhs(), - adaptor.getRhs(), rewriter); + return lowerIntBinaryOp( + op, adaptor.getLhs(), adaptor.getRhs(), rewriter); } mlir::LogicalResult CIRToLLVMAndOpLowering::matchAndRewrite( diff --git a/clang/test/CIR/CodeGen/binop.cpp b/clang/test/CIR/CodeGen/binop.cpp index c4f116ae64345..cd7661c75f8d3 100644 --- a/clang/test/CIR/CodeGen/binop.cpp +++ b/clang/test/CIR/CodeGen/binop.cpp @@ -134,10 +134,10 @@ void testFloatingPointBinOps(float a, float b) { } // CIR-LABEL: cir.func{{.*}} @_Z23testFloatingPointBinOpsff( -// CIR: cir.mul %{{.+}}, %{{.+}} : !cir.float -// CIR: cir.div %{{.+}}, %{{.+}} : !cir.float -// CIR: cir.add %{{.+}}, %{{.+}} : !cir.float -// CIR: cir.sub %{{.+}}, %{{.+}} : !cir.float +// CIR: cir.fmul %{{.+}}, %{{.+}} : !cir.float +// CIR: cir.fdiv %{{.+}}, %{{.+}} : !cir.float +// CIR: cir.fadd %{{.+}}, %{{.+}} : !cir.float +// CIR: cir.fsub %{{.+}}, %{{.+}} : !cir.float // CIR: cir.return // LLVM-LABEL: define{{.*}} void @_Z23testFloatingPointBinOpsff( diff --git a/clang/test/CIR/CodeGen/complex-compound-assignment.cpp b/clang/test/CIR/CodeGen/complex-compound-assignment.cpp index ffb16c1ffb46f..77c6686e57215 100644 --- a/clang/test/CIR/CodeGen/complex-compound-assignment.cpp +++ b/clang/test/CIR/CodeGen/complex-compound-assignment.cpp @@ -299,7 +299,7 @@ void foo5() { // CIR: %[[TMP_A:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr>, !cir.complex // CIR: %[[A_REAL:.*]] = cir.complex.real %[[TMP_A]] : !cir.complex -> !cir.float // CIR: %[[A_IMAG:.*]] = cir.complex.imag %[[TMP_A]] : !cir.complex -> !cir.float -// CIR: %[[RESULT_REAL:.*]] = cir.add %[[A_REAL]], %[[TMP_B]] : !cir.float +// CIR: %[[RESULT_REAL:.*]] = cir.fadd %[[A_REAL]], %[[TMP_B]] : !cir.float // CIR: %[[RESULT:.*]] = cir.complex.create %[[RESULT_REAL]], %[[A_IMAG]] : !cir.float -> !cir.complex // CIR: cir.store{{.*}} %[[RESULT]], %[[A_ADDR]] : !cir.complex, !cir.ptr> @@ -403,12 +403,12 @@ void foo7() { // CIR: %[[B_IMAG:.*]] = cir.complex.imag %[[TMP_B]] : !cir.complex -> !cir.float // CIR: %[[A_REAL:.*]] = cir.complex.real %[[TMP_A]] : !cir.complex -> !cir.float // CIR: %[[A_IMAG:.*]] = cir.complex.imag %[[TMP_A]] : !cir.complex -> !cir.float -// CIR: %[[MUL_BR_AR:.*]] = cir.mul %[[B_REAL]], %[[A_REAL]] : !cir.float -// CIR: %[[MUL_BI_AI:.*]] = cir.mul %[[B_IMAG]], %[[A_IMAG]] : !cir.float -// CIR: %[[MUL_BR_AI:.*]] = cir.mul %[[B_REAL]], %[[A_IMAG]] : !cir.float -// CIR: %[[MUL_BI_AR:.*]] = cir.mul %[[B_IMAG]], %[[A_REAL]] : !cir.float -// CIR: %[[C_REAL:.*]] = cir.sub %[[MUL_BR_AR]], %[[MUL_BI_AI]] : !cir.float -// CIR: %[[C_IMAG:.*]] = cir.add %[[MUL_BR_AI]], %[[MUL_BI_AR]] : !cir.float +// CIR: %[[MUL_BR_AR:.*]] = cir.fmul %[[B_REAL]], %[[A_REAL]] : !cir.float +// CIR: %[[MUL_BI_AI:.*]] = cir.fmul %[[B_IMAG]], %[[A_IMAG]] : !cir.float +// CIR: %[[MUL_BR_AI:.*]] = cir.fmul %[[B_REAL]], %[[A_IMAG]] : !cir.float +// CIR: %[[MUL_BI_AR:.*]] = cir.fmul %[[B_IMAG]], %[[A_REAL]] : !cir.float +// CIR: %[[C_REAL:.*]] = cir.fsub %[[MUL_BR_AR]], %[[MUL_BI_AI]] : !cir.float +// CIR: %[[C_IMAG:.*]] = cir.fadd %[[MUL_BR_AI]], %[[MUL_BI_AR]] : !cir.float // CIR: %[[COMPLEX:.*]] = cir.complex.create %[[C_REAL]], %[[C_IMAG]] : !cir.float -> !cir.complex // CIR: %[[IS_C_REAL_NAN:.*]] = cir.cmp ne %[[C_REAL]], %[[C_REAL]] : !cir.float // CIR: %[[IS_C_IMAG_NAN:.*]] = cir.cmp ne %[[C_IMAG]], %[[C_IMAG]] : !cir.float @@ -503,8 +503,8 @@ void foo8() { // CIR: %[[TMP_A:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr>, !cir.complex // CIR: %[[A_REAL:.*]] = cir.complex.real %[[TMP_A]] : !cir.complex -> !cir.float // CIR: %[[A_IMAG:.*]] = cir.complex.imag %[[TMP_A]] : !cir.complex -> !cir.float -// CIR: %[[RESULT_REAL:.*]] = cir.mul %[[A_REAL]], %[[TMP_B]] : !cir.float -// CIR: %[[RESULT_IMAG:.*]] = cir.mul %[[A_IMAG]], %[[TMP_B]] : !cir.float +// CIR: %[[RESULT_REAL:.*]] = cir.fmul %[[A_REAL]], %[[TMP_B]] : !cir.float +// CIR: %[[RESULT_IMAG:.*]] = cir.fmul %[[A_IMAG]], %[[TMP_B]] : !cir.float // CIR: %[[RESULT:.*]] = cir.complex.create %[[RESULT_REAL]], %[[RESULT_IMAG]] : !cir.float -> !cir.complex // CIR: cir.store{{.*}} %[[RESULT]], %[[A_ADDR]] : !cir.complex, !cir.ptr> @@ -596,8 +596,8 @@ void foo11() { // CIR: %[[TMP_A:.*]] = cir.load{{.*}} %[[A_ADDR]] : !cir.ptr>, !cir.complex // CIR: %[[A_REAL:.*]] = cir.complex.real %[[TMP_A]] : !cir.complex -> !cir.float // CIR: %[[A_IMAG:.*]] = cir.complex.imag %[[TMP_A]] : !cir.complex -> !cir.float -// CIR: %[[RESULT_REAL:.*]] = cir.div %[[A_REAL]], %[[TMP_B]] : !cir.float -// CIR: %[[RESULT_IMAG:.*]] = cir.div %[[A_IMAG]], %[[TMP_B]] : !cir.float +// CIR: %[[RESULT_REAL:.*]] = cir.fdiv %[[A_REAL]], %[[TMP_B]] : !cir.float +// CIR: %[[RESULT_IMAG:.*]] = cir.fdiv %[[A_IMAG]], %[[TMP_B]] : !cir.float // CIR: %[[RESULT:.*]] = cir.complex.create %[[RESULT_REAL]], %[[RESULT_IMAG]] : !cir.float -> !cir.complex // CIR: cir.store{{.*}} %[[RESULT]], %[[A_ADDR]] : !cir.complex, !cir.ptr> @@ -834,7 +834,7 @@ void foo9() { // C_CIR: %[[TMP_B:.*]] = cir.load{{.*}} %[[B_ADDR]] : !cir.ptr, !cir.float // C_CIR: %[[A_REAL:.*]] = cir.complex.real %[[A_ADDR]] : !cir.complex -> !cir.float // C_CIR: %[[A_IMAG:.*]] = cir.complex.imag %[[A_ADDR]] : !cir.complex -> !cir.float -// C_CIR: %[[NEW_REAL:.*]] = cir.add %[[TMP_B]], %[[A_REAL]] : !cir.float +// C_CIR: %[[NEW_REAL:.*]] = cir.fadd %[[TMP_B]], %[[A_REAL]] : !cir.float // C_CIR: %[[RESULT:.*]] = cir.complex.create %[[NEW_REAL]], %[[A_IMAG]] : !cir.float -> !cir.complex // C_CIR: %[[RESULT_REAL:.*]] = cir.complex.real %[[RESULT]] : !cir.complex -> !cir.float // C_CIR: cir.store{{.*}} %[[RESULT_REAL]], %[[B_ADDR]] : !cir.float, !cir.ptr diff --git a/clang/test/CIR/CodeGen/complex-mul-div.cpp b/clang/test/CIR/CodeGen/complex-mul-div.cpp index 3ae1544309382..92106223483c9 100644 --- a/clang/test/CIR/CodeGen/complex-mul-div.cpp +++ b/clang/test/CIR/CodeGen/complex-mul-div.cpp @@ -55,12 +55,12 @@ void foo() { // CIR-AFTER-MUL-COMBINED: %[[A_IMAG:.*]] = cir.complex.imag %[[TMP_A]] : !cir.complex -> !cir.float // CIR-AFTER-MUL-COMBINED: %[[B_REAL:.*]] = cir.complex.real %[[TMP_B]] : !cir.complex -> !cir.float // CIR-AFTER-MUL-COMBINED: %[[B_IMAG:.*]] = cir.complex.imag %[[TMP_B]] : !cir.complex -> !cir.float -// CIR-AFTER-MUL-COMBINED: %[[MUL_AR_BR:.*]] = cir.mul %[[A_REAL]], %[[B_REAL]] : !cir.float -// CIR-AFTER-MUL-COMBINED: %[[MUL_AI_BI:.*]] = cir.mul %[[A_IMAG]], %[[B_IMAG]] : !cir.float -// CIR-AFTER-MUL-COMBINED: %[[MUL_AR_BI:.*]] = cir.mul %[[A_REAL]], %[[B_IMAG]] : !cir.float -// CIR-AFTER-MUL-COMBINED: %[[MUL_AI_BR:.*]] = cir.mul %[[A_IMAG]], %[[B_REAL]] : !cir.float -// CIR-AFTER-MUL-COMBINED: %[[C_REAL:.*]] = cir.sub %[[MUL_AR_BR]], %[[MUL_AI_BI]] : !cir.float -// CIR-AFTER-MUL-COMBINED: %[[C_IMAG:.*]] = cir.add %[[MUL_AR_BI]], %[[MUL_AI_BR]] : !cir.float +// CIR-AFTER-MUL-COMBINED: %[[MUL_AR_BR:.*]] = cir.fmul %[[A_REAL]], %[[B_REAL]] : !cir.float +// CIR-AFTER-MUL-COMBINED: %[[MUL_AI_BI:.*]] = cir.fmul %[[A_IMAG]], %[[B_IMAG]] : !cir.float +// CIR-AFTER-MUL-COMBINED: %[[MUL_AR_BI:.*]] = cir.fmul %[[A_REAL]], %[[B_IMAG]] : !cir.float +// CIR-AFTER-MUL-COMBINED: %[[MUL_AI_BR:.*]] = cir.fmul %[[A_IMAG]], %[[B_REAL]] : !cir.float +// CIR-AFTER-MUL-COMBINED: %[[C_REAL:.*]] = cir.fsub %[[MUL_AR_BR]], %[[MUL_AI_BI]] : !cir.float +// CIR-AFTER-MUL-COMBINED: %[[C_IMAG:.*]] = cir.fadd %[[MUL_AR_BI]], %[[MUL_AI_BR]] : !cir.float // CIR-AFTER-MUL-COMBINED: %[[RESULT:.*]] = cir.complex.create %[[C_REAL]], %[[C_IMAG]] : !cir.float -> !cir.complex // CIR-AFTER-MUL-COMBINED: cir.store{{.*}} %[[RESULT]], %[[C_ADDR]] : !cir.complex, !cir.ptr> @@ -116,12 +116,12 @@ void foo() { // CIR-AFTER-FULL: %[[A_IMAG:.*]] = cir.complex.imag %[[TMP_A]] : !cir.complex -> !cir.float // CIR-AFTER-FULL: %[[B_REAL:.*]] = cir.complex.real %[[TMP_B]] : !cir.complex -> !cir.float // CIR-AFTER-FULL: %[[B_IMAG:.*]] = cir.complex.imag %[[TMP_B]] : !cir.complex -> !cir.float -// CIR-AFTER-FULL: %[[MUL_AR_BR:.*]] = cir.mul %[[A_REAL]], %[[B_REAL]] : !cir.float -// CIR-AFTER-FULL: %[[MUL_AI_BI:.*]] = cir.mul %[[A_IMAG]], %[[B_IMAG]] : !cir.float -// CIR-AFTER-FULL: %[[MUL_AR_BI:.*]] = cir.mul %[[A_REAL]], %[[B_IMAG]] : !cir.float -// CIR-AFTER-FULL: %[[MUL_AI_BR:.*]] = cir.mul %[[A_IMAG]], %[[B_REAL]] : !cir.float -// CIR-AFTER-FULL: %[[C_REAL:.*]] = cir.sub %[[MUL_AR_BR]], %[[MUL_AI_BI]] : !cir.float -// CIR-AFTER-FULL: %[[C_IMAG:.*]] = cir.add %[[MUL_AR_BI]], %[[MUL_AI_BR]] : !cir.float +// CIR-AFTER-FULL: %[[MUL_AR_BR:.*]] = cir.fmul %[[A_REAL]], %[[B_REAL]] : !cir.float +// CIR-AFTER-FULL: %[[MUL_AI_BI:.*]] = cir.fmul %[[A_IMAG]], %[[B_IMAG]] : !cir.float +// CIR-AFTER-FULL: %[[MUL_AR_BI:.*]] = cir.fmul %[[A_REAL]], %[[B_IMAG]] : !cir.float +// CIR-AFTER-FULL: %[[MUL_AI_BR:.*]] = cir.fmul %[[A_IMAG]], %[[B_REAL]] : !cir.float +// CIR-AFTER-FULL: %[[C_REAL:.*]] = cir.fsub %[[MUL_AR_BR]], %[[MUL_AI_BI]] : !cir.float +// CIR-AFTER-FULL: %[[C_IMAG:.*]] = cir.fadd %[[MUL_AR_BI]], %[[MUL_AI_BR]] : !cir.float // CIR-AFTER-FULL: %[[COMPLEX:.*]] = cir.complex.create %[[C_REAL]], %[[C_IMAG]] : !cir.float -> !cir.complex // CIR-AFTER-FULL: %[[IS_C_REAL_NAN:.*]] = cir.cmp ne %[[C_REAL]], %[[C_REAL]] : !cir.float // CIR-AFTER-FULL: %[[IS_C_IMAG_NAN:.*]] = cir.cmp ne %[[C_IMAG]], %[[C_IMAG]] : !cir.float @@ -292,8 +292,8 @@ void foo2() { // CIR-COMBINED: %[[TMP_B:.*]] = cir.load{{.*}} %1 : !cir.ptr, !cir.float // CIR-COMBINED: %[[A_REAL:.*]] = cir.complex.real %[[TMP_A]] : !cir.complex -> !cir.float // CIR-COMBINED: %[[A_IMAG:.*]] = cir.complex.imag %[[TMP_A]] : !cir.complex -> !cir.float -// CIR-COMBINED: %[[RESULT_REAL:.*]] = cir.mul %[[A_REAL]], %[[TMP_B]] : !cir.float -// CIR-COMBINED: %[[RESULT_IMAG:.*]] = cir.mul %[[A_IMAG]], %[[TMP_B]] : !cir.float +// CIR-COMBINED: %[[RESULT_REAL:.*]] = cir.fmul %[[A_REAL]], %[[TMP_B]] : !cir.float +// CIR-COMBINED: %[[RESULT_IMAG:.*]] = cir.fmul %[[A_IMAG]], %[[TMP_B]] : !cir.float // CIR-COMBINED: %[[RESULT:.*]] = cir.complex.create %[[RESULT_REAL]], %[[RESULT_IMAG]] : !cir.float -> !cir.complex // CIR-COMBINED: cir.store{{.*}} %[[RESULT]], %[[C_ADDR]] : !cir.complex, !cir.ptr> @@ -342,17 +342,17 @@ void foo3() { // CIR-AFTER-BASIC: %[[A_IMAG:.*]] = cir.complex.imag %[[TMP_A]] : !cir.complex -> !cir.float // CIR-AFTER-BASIC: %[[B_REAL:.*]] = cir.complex.real %[[TMP_B]] : !cir.complex -> !cir.float // CIR-AFTER-BASIC: %[[B_IMAG:.*]] = cir.complex.imag %[[TMP_B]] : !cir.complex -> !cir.float -// CIR-AFTER-BASIC: %[[MUL_AR_BR:.*]] = cir.mul %[[A_REAL]], %[[B_REAL]] : !cir.float -// CIR-AFTER-BASIC: %[[MUL_AI_BI:.*]] = cir.mul %[[A_IMAG]], %[[B_IMAG]] : !cir.float -// CIR-AFTER-BASIC: %[[MUL_BR_BR:.*]] = cir.mul %[[B_REAL]], %[[B_REAL]] : !cir.float -// CIR-AFTER-BASIC: %[[MUL_BI_BI:.*]] = cir.mul %[[B_IMAG]], %[[B_IMAG]] : !cir.float -// CIR-AFTER-BASIC: %[[ADD_ARBR_AIBI:.*]] = cir.add %[[MUL_AR_BR]], %[[MUL_AI_BI]] : !cir.float -// CIR-AFTER-BASIC: %[[ADD_BRBR_BIBI:.*]] = cir.add %[[MUL_BR_BR]], %[[MUL_BI_BI]] : !cir.float -// CIR-AFTER-BASIC: %[[RESULT_REAL:.*]] = cir.div %[[ADD_ARBR_AIBI]], %[[ADD_BRBR_BIBI]] : !cir.float -// CIR-AFTER-BASIC: %[[MUL_AI_BR:.*]] = cir.mul %[[A_IMAG]], %[[B_REAL]] : !cir.float -// CIR-AFTER-BASIC: %[[MUL_AR_BI:.*]] = cir.mul %[[A_REAL]], %[[B_IMAG]] : !cir.float -// CIR-AFTER-BASIC: %[[SUB_AIBR_ARBI:.*]] = cir.sub %[[MUL_AI_BR]], %[[MUL_AR_BI]] : !cir.float -// CIR-AFTER-BASIC: %[[RESULT_IMAG:.*]] = cir.div %[[SUB_AIBR_ARBI]], %[[ADD_BRBR_BIBI]] : !cir.float +// CIR-AFTER-BASIC: %[[MUL_AR_BR:.*]] = cir.fmul %[[A_REAL]], %[[B_REAL]] : !cir.float +// CIR-AFTER-BASIC: %[[MUL_AI_BI:.*]] = cir.fmul %[[A_IMAG]], %[[B_IMAG]] : !cir.float +// CIR-AFTER-BASIC: %[[MUL_BR_BR:.*]] = cir.fmul %[[B_REAL]], %[[B_REAL]] : !cir.float +// CIR-AFTER-BASIC: %[[MUL_BI_BI:.*]] = cir.fmul %[[B_IMAG]], %[[B_IMAG]] : !cir.float +// CIR-AFTER-BASIC: %[[ADD_ARBR_AIBI:.*]] = cir.fadd %[[MUL_AR_BR]], %[[MUL_AI_BI]] : !cir.float +// CIR-AFTER-BASIC: %[[ADD_BRBR_BIBI:.*]] = cir.fadd %[[MUL_BR_BR]], %[[MUL_BI_BI]] : !cir.float +// CIR-AFTER-BASIC: %[[RESULT_REAL:.*]] = cir.fdiv %[[ADD_ARBR_AIBI]], %[[ADD_BRBR_BIBI]] : !cir.float +// CIR-AFTER-BASIC: %[[MUL_AI_BR:.*]] = cir.fmul %[[A_IMAG]], %[[B_REAL]] : !cir.float +// CIR-AFTER-BASIC: %[[MUL_AR_BI:.*]] = cir.fmul %[[A_REAL]], %[[B_IMAG]] : !cir.float +// CIR-AFTER-BASIC: %[[SUB_AIBR_ARBI:.*]] = cir.fsub %[[MUL_AI_BR]], %[[MUL_AR_BI]] : !cir.float +// CIR-AFTER-BASIC: %[[RESULT_IMAG:.*]] = cir.fdiv %[[SUB_AIBR_ARBI]], %[[ADD_BRBR_BIBI]] : !cir.float // CIR-AFTER-BASIC: %[[RESULT:.*]] = cir.complex.create %[[RESULT_REAL]], %[[RESULT_IMAG]] : !cir.float -> !cir.complex // CIR-AFTER-BASIC: cir.store{{.*}} %[[RESULT]], %[[C_ADDR]] : !cir.complex, !cir.ptr> @@ -422,27 +422,27 @@ void foo3() { // CIR-AFTER-IMPROVED: %[[ABS_B_IMAG:.*]] = cir.fabs %[[B_IMAG]] : !cir.float // CIR-AFTER-IMPROVED: %[[ABS_B_CMP:.*]] = cir.cmp ge %[[ABS_B_REAL]], %[[ABS_B_IMAG]] : !cir.float // CIR-AFTER-IMPROVED: %[[RESULT:.*]] = cir.ternary(%[[ABS_B_CMP]], true { -// CIR-AFTER-IMPROVED: %[[DIV_BI_BR:.*]] = cir.div %[[B_IMAG]], %[[B_REAL]] : !cir.float -// CIR-AFTER-IMPROVED: %[[MUL_DIV_BIBR_BI:.*]] = cir.mul %[[DIV_BI_BR]], %[[B_IMAG]] : !cir.float -// CIR-AFTER-IMPROVED: %[[ADD_BR_MUL_DIV_BIBR_BI:.*]] = cir.add %[[B_REAL]], %[[MUL_DIV_BIBR_BI]] : !cir.float -// CIR-AFTER-IMPROVED: %[[MUL_AI_DIV_BIBR:.*]] = cir.mul %[[A_IMAG]], %[[DIV_BI_BR]] : !cir.float -// CIR-AFTER-IMPROVED: %[[ADD_AR_MUL_AI_DIV_BIBR:.*]] = cir.add %[[A_REAL]], %[[MUL_AI_DIV_BIBR]] : !cir.float -// CIR-AFTER-IMPROVED: %[[RESULT_REAL:.*]] = cir.div %[[ADD_AR_MUL_AI_DIV_BIBR]], %[[ADD_BR_MUL_DIV_BIBR_BI]] : !cir.float -// CIR-AFTER-IMPROVED: %[[MUL_AR_DIV_BIBR:.*]] = cir.mul %[[A_REAL]], %[[DIV_BI_BR]] : !cir.float -// CIR-AFTER-IMPROVED: %[[SUB_AI_MUL_AR_DIV_BIBR:.*]] = cir.sub %[[A_IMAG]], %[[MUL_AR_DIV_BIBR]] : !cir.float -// CIR-AFTER-IMPROVED: %[[RESULT_IMAG:.*]] = cir.div %[[SUB_AI_MUL_AR_DIV_BIBR]], %[[ADD_BR_MUL_DIV_BIBR_BI]] : !cir.float +// CIR-AFTER-IMPROVED: %[[DIV_BI_BR:.*]] = cir.fdiv %[[B_IMAG]], %[[B_REAL]] : !cir.float +// CIR-AFTER-IMPROVED: %[[MUL_DIV_BIBR_BI:.*]] = cir.fmul %[[DIV_BI_BR]], %[[B_IMAG]] : !cir.float +// CIR-AFTER-IMPROVED: %[[ADD_BR_MUL_DIV_BIBR_BI:.*]] = cir.fadd %[[B_REAL]], %[[MUL_DIV_BIBR_BI]] : !cir.float +// CIR-AFTER-IMPROVED: %[[MUL_AI_DIV_BIBR:.*]] = cir.fmul %[[A_IMAG]], %[[DIV_BI_BR]] : !cir.float +// CIR-AFTER-IMPROVED: %[[ADD_AR_MUL_AI_DIV_BIBR:.*]] = cir.fadd %[[A_REAL]], %[[MUL_AI_DIV_BIBR]] : !cir.float +// CIR-AFTER-IMPROVED: %[[RESULT_REAL:.*]] = cir.fdiv %[[ADD_AR_MUL_AI_DIV_BIBR]], %[[ADD_BR_MUL_DIV_BIBR_BI]] : !cir.float +// CIR-AFTER-IMPROVED: %[[MUL_AR_DIV_BIBR:.*]] = cir.fmul %[[A_REAL]], %[[DIV_BI_BR]] : !cir.float +// CIR-AFTER-IMPROVED: %[[SUB_AI_MUL_AR_DIV_BIBR:.*]] = cir.fsub %[[A_IMAG]], %[[MUL_AR_DIV_BIBR]] : !cir.float +// CIR-AFTER-IMPROVED: %[[RESULT_IMAG:.*]] = cir.fdiv %[[SUB_AI_MUL_AR_DIV_BIBR]], %[[ADD_BR_MUL_DIV_BIBR_BI]] : !cir.float // CIR-AFTER-IMPROVED: %[[RESULT_COMPLEX:.*]] = cir.complex.create %[[RESULT_REAL]], %[[RESULT_IMAG]] : !cir.float -> !cir.complex // CIR-AFTER-IMPROVED: cir.yield %[[RESULT_COMPLEX]] : !cir.complex // CIR-AFTER-IMPROVED: }, false { -// CIR-AFTER-IMPROVED: %[[DIV_BR_BI:.*]] = cir.div %[[B_REAL]], %[[B_IMAG]] : !cir.float -// CIR-AFTER-IMPROVED: %[[MUL_DIV_BRBI_BR:.*]] = cir.mul %[[DIV_BR_BI]], %[[B_REAL]] : !cir.float -// CIR-AFTER-IMPROVED: %[[ADD_BI_MUL_DIV_BRBI_BR:.*]] = cir.add %[[B_IMAG]], %[[MUL_DIV_BRBI_BR]] : !cir.float -// CIR-AFTER-IMPROVED: %[[MUL_AR_DIV_BIBR:.*]] = cir.mul %[[A_REAL]], %[[DIV_BR_BI]] : !cir.float -// CIR-AFTER-IMPROVED: %[[ADD_MUL_AR_DIV_BRBI_AI:.*]] = cir.add %[[MUL_AR_DIV_BIBR]], %[[A_IMAG]] : !cir.float -// CIR-AFTER-IMPROVED: %[[RESULT_REAL:.*]] = cir.div %[[ADD_MUL_AR_DIV_BRBI_AI]], %[[ADD_BI_MUL_DIV_BRBI_BR]] : !cir.float -// CIR-AFTER-IMPROVED: %[[MUL_AI_DIV_BRBI:.*]] = cir.mul %[[A_IMAG]], %[[DIV_BR_BI]] : !cir.float -// CIR-AFTER-IMPROVED: %[[SUB_MUL_AI_DIV_BRBI_AR:.*]] = cir.sub %[[MUL_AI_DIV_BRBI]], %[[A_REAL]] : !cir.float -// CIR-AFTER-IMPROVED: %[[RESULT_IMAG:.*]] = cir.div %[[SUB_MUL_AI_DIV_BRBI_AR]], %[[ADD_BI_MUL_DIV_BRBI_BR]] : !cir.float +// CIR-AFTER-IMPROVED: %[[DIV_BR_BI:.*]] = cir.fdiv %[[B_REAL]], %[[B_IMAG]] : !cir.float +// CIR-AFTER-IMPROVED: %[[MUL_DIV_BRBI_BR:.*]] = cir.fmul %[[DIV_BR_BI]], %[[B_REAL]] : !cir.float +// CIR-AFTER-IMPROVED: %[[ADD_BI_MUL_DIV_BRBI_BR:.*]] = cir.fadd %[[B_IMAG]], %[[MUL_DIV_BRBI_BR]] : !cir.float +// CIR-AFTER-IMPROVED: %[[MUL_AR_DIV_BIBR:.*]] = cir.fmul %[[A_REAL]], %[[DIV_BR_BI]] : !cir.float +// CIR-AFTER-IMPROVED: %[[ADD_MUL_AR_DIV_BRBI_AI:.*]] = cir.fadd %[[MUL_AR_DIV_BIBR]], %[[A_IMAG]] : !cir.float +// CIR-AFTER-IMPROVED: %[[RESULT_REAL:.*]] = cir.fdiv %[[ADD_MUL_AR_DIV_BRBI_AI]], %[[ADD_BI_MUL_DIV_BRBI_BR]] : !cir.float +// CIR-AFTER-IMPROVED: %[[MUL_AI_DIV_BRBI:.*]] = cir.fmul %[[A_IMAG]], %[[DIV_BR_BI]] : !cir.float +// CIR-AFTER-IMPROVED: %[[SUB_MUL_AI_DIV_BRBI_AR:.*]] = cir.fsub %[[MUL_AI_DIV_BRBI]], %[[A_REAL]] : !cir.float +// CIR-AFTER-IMPROVED: %[[RESULT_IMAG:.*]] = cir.fdiv %[[SUB_MUL_AI_DIV_BRBI_AR]], %[[ADD_BI_MUL_DIV_BRBI_BR]] : !cir.float // CIR-AFTER-IMPROVED: %[[RESULT_COMPLEX:.*]] = cir.complex.create %[[RESULT_REAL]], %[[RESULT_IMAG]] : !cir.float -> !cir.complex // CIR-AFTER-IMPROVED: cir.yield %[[RESULT_COMPLEX]] : !cir.complex // CIR-AFTER-IMPROVED: }) : (!cir.bool) -> !cir.complex @@ -553,17 +553,17 @@ void foo3() { // CIR-AFTER-PROMOTED: %[[A_IMAG_F64:.*]] = cir.cast floating %[[A_IMAG]] : !cir.float -> !cir.double // CIR-AFTER-PROMOTED: %[[B_REAL_F64:.*]] = cir.cast floating %[[B_REAL]] : !cir.float -> !cir.double // CIR-AFTER-PROMOTED: %[[B_IMAG_F64:.*]] = cir.cast floating %[[B_IMAG]] : !cir.float -> !cir.double -// CIR-AFTER-PROMOTED: %[[MUL_AR_BR:.*]] = cir.mul %[[A_REAL_F64]], %[[B_REAL_F64]] : !cir.double -// CIR-AFTER-PROMOTED: %[[MUL_AI_BI:.*]] = cir.mul %[[A_IMAG_F64]], %[[B_IMAG_F64]] : !cir.double -// CIR-AFTER-PROMOTED: %[[MUL_BR_BR:.*]] = cir.mul %[[B_REAL_F64]], %[[B_REAL_F64]] : !cir.double -// CIR-AFTER-PROMOTED: %[[MUL_BI_BI:.*]] = cir.mul %[[B_IMAG_F64]], %[[B_IMAG_F64]] : !cir.double -// CIR-AFTER-PROMOTED: %[[ADD_ARBR_AIBI:.*]] = cir.add %[[MUL_AR_BR]], %[[MUL_AI_BI]] : !cir.double -// CIR-AFTER-PROMOTED: %[[ADD_BRBR_BIBI:.*]] = cir.add %[[MUL_BR_BR]], %[[MUL_BI_BI]] : !cir.double -// CIR-AFTER-PROMOTED: %[[RESULT_REAL:.*]] = cir.div %[[ADD_ARBR_AIBI]], %[[ADD_BRBR_BIBI]] : !cir.double -// CIR-AFTER-PROMOTED: %[[MUL_AI_BR:.*]] = cir.mul %[[A_IMAG_F64]], %[[B_REAL_F64]] : !cir.double -// CIR-AFTER-PROMOTED: %[[MUL_AR_BI:.*]] = cir.mul %[[A_REAL_F64]], %[[B_IMAG_F64]] : !cir.double -// CIR-AFTER-PROMOTED: %[[SUB_AIBR_ARBI:.*]] = cir.sub %[[MUL_AI_BR]], %[[MUL_AR_BI]] : !cir.double -// CIR-AFTER-PROMOTED: %[[RESULT_IMAG:.*]] = cir.div %[[SUB_AIBR_ARBI]], %[[ADD_BRBR_BIBI]] : !cir.double +// CIR-AFTER-PROMOTED: %[[MUL_AR_BR:.*]] = cir.fmul %[[A_REAL_F64]], %[[B_REAL_F64]] : !cir.double +// CIR-AFTER-PROMOTED: %[[MUL_AI_BI:.*]] = cir.fmul %[[A_IMAG_F64]], %[[B_IMAG_F64]] : !cir.double +// CIR-AFTER-PROMOTED: %[[MUL_BR_BR:.*]] = cir.fmul %[[B_REAL_F64]], %[[B_REAL_F64]] : !cir.double +// CIR-AFTER-PROMOTED: %[[MUL_BI_BI:.*]] = cir.fmul %[[B_IMAG_F64]], %[[B_IMAG_F64]] : !cir.double +// CIR-AFTER-PROMOTED: %[[ADD_ARBR_AIBI:.*]] = cir.fadd %[[MUL_AR_BR]], %[[MUL_AI_BI]] : !cir.double +// CIR-AFTER-PROMOTED: %[[ADD_BRBR_BIBI:.*]] = cir.fadd %[[MUL_BR_BR]], %[[MUL_BI_BI]] : !cir.double +// CIR-AFTER-PROMOTED: %[[RESULT_REAL:.*]] = cir.fdiv %[[ADD_ARBR_AIBI]], %[[ADD_BRBR_BIBI]] : !cir.double +// CIR-AFTER-PROMOTED: %[[MUL_AI_BR:.*]] = cir.fmul %[[A_IMAG_F64]], %[[B_REAL_F64]] : !cir.double +// CIR-AFTER-PROMOTED: %[[MUL_AR_BI:.*]] = cir.fmul %[[A_REAL_F64]], %[[B_IMAG_F64]] : !cir.double +// CIR-AFTER-PROMOTED: %[[SUB_AIBR_ARBI:.*]] = cir.fsub %[[MUL_AI_BR]], %[[MUL_AR_BI]] : !cir.double +// CIR-AFTER-PROMOTED: %[[RESULT_IMAG:.*]] = cir.fdiv %[[SUB_AIBR_ARBI]], %[[ADD_BRBR_BIBI]] : !cir.double // CIR-AFTER-PROMOTED: %[[RESULT_F64:.*]] = cir.complex.create %[[RESULT_REAL]], %[[RESULT_IMAG]] : !cir.double -> !cir.complex // CIR-AFTER-PROMOTED: %[[RESULT_REAL_F64:.*]] = cir.complex.real %[[RESULT_F64]] : !cir.complex -> !cir.double // CIR-AFTER-PROMOTED: %[[RESULT_IMAG_F64:.*]] = cir.complex.imag %[[RESULT_F64]] : !cir.complex -> !cir.double @@ -787,8 +787,8 @@ void foo5() { // CIR-COMBINED: %[[TMP_B:.*]] = cir.load{{.*}} %[[B_ADDR]] : !cir.ptr, !cir.float // CIR-COMBINED: %[[A_REAL:.*]] = cir.complex.real %[[TMP_A]] : !cir.complex -> !cir.float // CIR-COMBINED: %[[A_IMGA:.*]] = cir.complex.imag %[[TMP_A]] : !cir.complex -> !cir.float -// CIR-COMBINED: %[[RESULT_REAL:.*]] = cir.div %[[A_REAL]], %[[TMP_B]] : !cir.float -// CIR-COMBINED: %[[RESULT_IMAG:.*]] = cir.div %[[A_IMAG]], %[[TMP_B]] : !cir.float +// CIR-COMBINED: %[[RESULT_REAL:.*]] = cir.fdiv %[[A_REAL]], %[[TMP_B]] : !cir.float +// CIR-COMBINED: %[[RESULT_IMAG:.*]] = cir.fdiv %[[A_IMAG]], %[[TMP_B]] : !cir.float // CIR-COMBINED: %[[RESULT:.*]] = cir.complex.create %[[RESULT_REAL]], %[[RESULT_IMAG]] : !cir.float -> !cir.complex // CIR-COMBINED: cir.store{{.*}} %[[RESULT]], %[[C_ADDR]] : !cir.complex, !cir.ptr> @@ -839,17 +839,17 @@ void foo6() { // CIR-AFTER-BASIC: %[[A_IMAG:.*]] = cir.complex.imag %[[COMPLEX_A]] : !cir.complex -> !cir.float // CIR-AFTER-BASIC: %[[B_REAL:.*]] = cir.complex.real %[[TMP_B]] : !cir.complex -> !cir.float // CIR-AFTER-BASIC: %[[B_IMAG:.*]] = cir.complex.imag %[[TMP_B]] : !cir.complex -> !cir.float -// CIR-AFTER-BASIC: %[[MUL_AR_BR:.*]] = cir.mul %[[A_REAL]], %[[B_REAL]] : !cir.float -// CIR-AFTER-BASIC: %[[MUL_AI_BI:.*]] = cir.mul %[[A_IMAG]], %[[B_IMAG]] : !cir.float -// CIR-AFTER-BASIC: %[[MUL_BR_BR:.*]] = cir.mul %[[B_REAL]], %[[B_REAL]] : !cir.float -// CIR-AFTER-BASIC: %[[MUL_BI_BI:.*]] = cir.mul %[[B_IMAG]], %[[B_IMAG]] : !cir.float -// CIR-AFTER-BASIC: %[[ADD_ARBR_AIBI:.*]] = cir.add %[[MUL_AR_BR]], %[[MUL_AI_BI]] : !cir.float -// CIR-AFTER-BASIC: %[[ADD_BRBR_BIBI:.*]] = cir.add %[[MUL_BR_BR]], %[[MUL_BI_BI]] : !cir.float -// CIR-AFTER-BASIC: %[[RESULT_REAL:.*]] = cir.div %[[ADD_ARBR_AIBI]], %[[ADD_BRBR_BIBI]] : !cir.float -// CIR-AFTER-BASIC: %[[MUL_AI_BR:.*]] = cir.mul %[[A_IMAG]], %[[B_REAL]] : !cir.float -// CIR-AFTER-BASIC: %[[MUL_AR_BI:.*]] = cir.mul %[[A_REAL]], %[[B_IMAG]] : !cir.float -// CIR-AFTER-BASIC: %[[SUB_AIBR_ARBI:.*]] = cir.sub %[[MUL_AI_BR]], %[[MUL_AR_BI]] : !cir.float -// CIR-AFTER-BASIC: %[[RESULT_IMAG:.*]] = cir.div %[[SUB_AIBR_ARBI]], %[[ADD_BRBR_BIBI]] : !cir.float +// CIR-AFTER-BASIC: %[[MUL_AR_BR:.*]] = cir.fmul %[[A_REAL]], %[[B_REAL]] : !cir.float +// CIR-AFTER-BASIC: %[[MUL_AI_BI:.*]] = cir.fmul %[[A_IMAG]], %[[B_IMAG]] : !cir.float +// CIR-AFTER-BASIC: %[[MUL_BR_BR:.*]] = cir.fmul %[[B_REAL]], %[[B_REAL]] : !cir.float +// CIR-AFTER-BASIC: %[[MUL_BI_BI:.*]] = cir.fmul %[[B_IMAG]], %[[B_IMAG]] : !cir.float +// CIR-AFTER-BASIC: %[[ADD_ARBR_AIBI:.*]] = cir.fadd %[[MUL_AR_BR]], %[[MUL_AI_BI]] : !cir.float +// CIR-AFTER-BASIC: %[[ADD_BRBR_BIBI:.*]] = cir.fadd %[[MUL_BR_BR]], %[[MUL_BI_BI]] : !cir.float +// CIR-AFTER-BASIC: %[[RESULT_REAL:.*]] = cir.fdiv %[[ADD_ARBR_AIBI]], %[[ADD_BRBR_BIBI]] : !cir.float +// CIR-AFTER-BASIC: %[[MUL_AI_BR:.*]] = cir.fmul %[[A_IMAG]], %[[B_REAL]] : !cir.float +// CIR-AFTER-BASIC: %[[MUL_AR_BI:.*]] = cir.fmul %[[A_REAL]], %[[B_IMAG]] : !cir.float +// CIR-AFTER-BASIC: %[[SUB_AIBR_ARBI:.*]] = cir.fsub %[[MUL_AI_BR]], %[[MUL_AR_BI]] : !cir.float +// CIR-AFTER-BASIC: %[[RESULT_IMAG:.*]] = cir.fdiv %[[SUB_AIBR_ARBI]], %[[ADD_BRBR_BIBI]] : !cir.float // CIR-AFTER-BASIC: %[[RESULT:.*]] = cir.complex.create %[[RESULT_REAL]], %[[RESULT_IMAG]] : !cir.float -> !cir.complex // CIR-AFTER-BASIC: cir.store{{.*}} %[[RESULT]], %[[C_ADDR]] : !cir.complex, !cir.ptr> @@ -918,27 +918,27 @@ void foo6() { // CIR-AFTER-IMPROVED: %[[ABS_B_IMAG:.*]] = cir.fabs %[[B_IMAG]] : !cir.float // CIR-AFTER-IMPROVED: %[[ABS_B_CMP:.*]] = cir.cmp ge %[[ABS_B_REAL]], %[[ABS_B_IMAG]] : !cir.float // CIR-AFTER-IMPROVED: %[[RESULT:.*]] = cir.ternary(%[[ABS_B_CMP]], true { -// CIR-AFTER-IMPROVED: %[[DIV_BI_BR:.*]] = cir.div %[[B_IMAG]], %[[B_REAL]] : !cir.float -// CIR-AFTER-IMPROVED: %[[MUL_DIV_BIBR_BI:.*]] = cir.mul %[[DIV_BI_BR]], %[[B_IMAG]] : !cir.float -// CIR-AFTER-IMPROVED: %[[ADD_BR_MUL_DIV_BIBR_BI:.*]] = cir.add %[[B_REAL]], %[[MUL_DIV_BIBR_BI]] : !cir.float -// CIR-AFTER-IMPROVED: %[[MUL_AI_DIV_BIBR:.*]] = cir.mul %[[A_IMAG]], %[[DIV_BI_BR]] : !cir.float -// CIR-AFTER-IMPROVED: %[[ADD_AR_MUL_AI_DIV_BIBR:.*]] = cir.add %[[A_REAL]], %[[MUL_AI_DIV_BIBR]] : !cir.float -// CIR-AFTER-IMPROVED: %[[RESULT_REAL:.*]] = cir.div %[[ADD_AR_MUL_AI_DIV_BIBR]], %[[ADD_BR_MUL_DIV_BIBR_BI]] : !cir.float -// CIR-AFTER-IMPROVED: %[[MUL_AR_DIV_BIBR:.*]] = cir.mul %[[A_REAL]], %[[DIV_BI_BR]] : !cir.float -// CIR-AFTER-IMPROVED: %[[SUB_AI_MUL_AR_DIV_BIBR:.*]] = cir.sub %[[A_IMAG]], %[[MUL_AR_DIV_BIBR]] : !cir.float -// CIR-AFTER-IMPROVED: %[[RESULT_IMAG:.*]] = cir.div %[[SUB_AI_MUL_AR_DIV_BIBR]], %[[ADD_BR_MUL_DIV_BIBR_BI]] : !cir.float +// CIR-AFTER-IMPROVED: %[[DIV_BI_BR:.*]] = cir.fdiv %[[B_IMAG]], %[[B_REAL]] : !cir.float +// CIR-AFTER-IMPROVED: %[[MUL_DIV_BIBR_BI:.*]] = cir.fmul %[[DIV_BI_BR]], %[[B_IMAG]] : !cir.float +// CIR-AFTER-IMPROVED: %[[ADD_BR_MUL_DIV_BIBR_BI:.*]] = cir.fadd %[[B_REAL]], %[[MUL_DIV_BIBR_BI]] : !cir.float +// CIR-AFTER-IMPROVED: %[[MUL_AI_DIV_BIBR:.*]] = cir.fmul %[[A_IMAG]], %[[DIV_BI_BR]] : !cir.float +// CIR-AFTER-IMPROVED: %[[ADD_AR_MUL_AI_DIV_BIBR:.*]] = cir.fadd %[[A_REAL]], %[[MUL_AI_DIV_BIBR]] : !cir.float +// CIR-AFTER-IMPROVED: %[[RESULT_REAL:.*]] = cir.fdiv %[[ADD_AR_MUL_AI_DIV_BIBR]], %[[ADD_BR_MUL_DIV_BIBR_BI]] : !cir.float +// CIR-AFTER-IMPROVED: %[[MUL_AR_DIV_BIBR:.*]] = cir.fmul %[[A_REAL]], %[[DIV_BI_BR]] : !cir.float +// CIR-AFTER-IMPROVED: %[[SUB_AI_MUL_AR_DIV_BIBR:.*]] = cir.fsub %[[A_IMAG]], %[[MUL_AR_DIV_BIBR]] : !cir.float +// CIR-AFTER-IMPROVED: %[[RESULT_IMAG:.*]] = cir.fdiv %[[SUB_AI_MUL_AR_DIV_BIBR]], %[[ADD_BR_MUL_DIV_BIBR_BI]] : !cir.float // CIR-AFTER-IMPROVED: %[[RESULT_COMPLEX:.*]] = cir.complex.create %[[RESULT_REAL]], %[[RESULT_IMAG]] : !cir.float -> !cir.complex // CIR-AFTER-IMPROVED: cir.yield %[[RESULT_COMPLEX]] : !cir.complex // CIR-AFTER-IMPROVED: }, false { -// CIR-AFTER-IMPROVED: %[[DIV_BR_BI:.*]] = cir.div %[[B_REAL]], %[[B_IMAG]] : !cir.float -// CIR-AFTER-IMPROVED: %[[MUL_DIV_BRBI_BR:.*]] = cir.mul %[[DIV_BR_BI]], %[[B_REAL]] : !cir.float -// CIR-AFTER-IMPROVED: %[[ADD_BI_MUL_DIV_BRBI_BR:.*]] = cir.add %[[B_IMAG]], %[[MUL_DIV_BRBI_BR]] : !cir.float -// CIR-AFTER-IMPROVED: %[[MUL_AR_DIV_BIBR:.*]] = cir.mul %[[A_REAL]], %[[DIV_BR_BI]] : !cir.float -// CIR-AFTER-IMPROVED: %[[ADD_MUL_AR_DIV_BRBI_AI:.*]] = cir.add %[[MUL_AR_DIV_BIBR]], %[[A_IMAG]] : !cir.float -// CIR-AFTER-IMPROVED: %[[RESULT_REAL:.*]] = cir.div %[[ADD_MUL_AR_DIV_BRBI_AI]], %[[ADD_BI_MUL_DIV_BRBI_BR]] : !cir.float -// CIR-AFTER-IMPROVED: %[[MUL_AI_DIV_BRBI:.*]] = cir.mul %[[A_IMAG]], %[[DIV_BR_BI]] : !cir.float -// CIR-AFTER-IMPROVED: %[[SUB_MUL_AI_DIV_BRBI_AR:.*]] = cir.sub %[[MUL_AI_DIV_BRBI]], %[[A_REAL]] : !cir.float -// CIR-AFTER-IMPROVED: %[[RESULT_IMAG:.*]] = cir.div %[[SUB_MUL_AI_DIV_BRBI_AR]], %[[ADD_BI_MUL_DIV_BRBI_BR]] : !cir.float +// CIR-AFTER-IMPROVED: %[[DIV_BR_BI:.*]] = cir.fdiv %[[B_REAL]], %[[B_IMAG]] : !cir.float +// CIR-AFTER-IMPROVED: %[[MUL_DIV_BRBI_BR:.*]] = cir.fmul %[[DIV_BR_BI]], %[[B_REAL]] : !cir.float +// CIR-AFTER-IMPROVED: %[[ADD_BI_MUL_DIV_BRBI_BR:.*]] = cir.fadd %[[B_IMAG]], %[[MUL_DIV_BRBI_BR]] : !cir.float +// CIR-AFTER-IMPROVED: %[[MUL_AR_DIV_BIBR:.*]] = cir.fmul %[[A_REAL]], %[[DIV_BR_BI]] : !cir.float +// CIR-AFTER-IMPROVED: %[[ADD_MUL_AR_DIV_BRBI_AI:.*]] = cir.fadd %[[MUL_AR_DIV_BIBR]], %[[A_IMAG]] : !cir.float +// CIR-AFTER-IMPROVED: %[[RESULT_REAL:.*]] = cir.fdiv %[[ADD_MUL_AR_DIV_BRBI_AI]], %[[ADD_BI_MUL_DIV_BRBI_BR]] : !cir.float +// CIR-AFTER-IMPROVED: %[[MUL_AI_DIV_BRBI:.*]] = cir.fmul %[[A_IMAG]], %[[DIV_BR_BI]] : !cir.float +// CIR-AFTER-IMPROVED: %[[SUB_MUL_AI_DIV_BRBI_AR:.*]] = cir.fsub %[[MUL_AI_DIV_BRBI]], %[[A_REAL]] : !cir.float +// CIR-AFTER-IMPROVED: %[[RESULT_IMAG:.*]] = cir.fdiv %[[SUB_MUL_AI_DIV_BRBI_AR]], %[[ADD_BI_MUL_DIV_BRBI_BR]] : !cir.float // CIR-AFTER-IMPROVED: %[[RESULT_COMPLEX:.*]] = cir.complex.create %[[RESULT_REAL]], %[[RESULT_IMAG]] : !cir.float -> !cir.complex // CIR-AFTER-IMPROVED: cir.yield %[[RESULT_COMPLEX]] : !cir.complex // CIR-AFTER-IMPROVED: }) : (!cir.bool) -> !cir.complex @@ -1048,17 +1048,17 @@ void foo6() { // CIR-AFTER-PROMOTED: %[[A_IMAG_F64:.*]] = cir.cast floating %[[A_IMAG]] : !cir.float -> !cir.double // CIR-AFTER-PROMOTED: %[[B_REAL_F64:.*]] = cir.cast floating %[[B_REAL]] : !cir.float -> !cir.double // CIR-AFTER-PROMOTED: %[[B_IMAG_F64:.*]] = cir.cast floating %[[B_IMAG]] : !cir.float -> !cir.double -// CIR-AFTER-PROMOTED: %[[MUL_AR_BR:.*]] = cir.mul %[[A_REAL_F64]], %[[B_REAL_F64]] : !cir.double -// CIR-AFTER-PROMOTED: %[[MUL_AI_BI:.*]] = cir.mul %[[A_IMAG_F64]], %[[B_IMAG_F64]] : !cir.double -// CIR-AFTER-PROMOTED: %[[MUL_BR_BR:.*]] = cir.mul %[[B_REAL_F64]], %[[B_REAL_F64]] : !cir.double -// CIR-AFTER-PROMOTED: %[[MUL_BI_BI:.*]] = cir.mul %[[B_IMAG_F64]], %[[B_IMAG_F64]] : !cir.double -// CIR-AFTER-PROMOTED: %[[ADD_ARBR_AIBI:.*]] = cir.add %[[MUL_AR_BR]], %[[MUL_AI_BI]] : !cir.double -// CIR-AFTER-PROMOTED: %[[ADD_BRBR_BIBI:.*]] = cir.add %[[MUL_BR_BR]], %[[MUL_BI_BI]] : !cir.double -// CIR-AFTER-PROMOTED: %[[RESULT_REAL:.*]] = cir.div %[[ADD_ARBR_AIBI]], %[[ADD_BRBR_BIBI]] : !cir.double -// CIR-AFTER-PROMOTED: %[[MUL_AI_BR:.*]] = cir.mul %[[A_IMAG_F64]], %[[B_REAL_F64]] : !cir.double -// CIR-AFTER-PROMOTED: %[[MUL_AR_BI:.*]] = cir.mul %[[A_REAL_F64]], %[[B_IMAG_F64]] : !cir.double -// CIR-AFTER-PROMOTED: %[[SUB_AIBR_ARBI:.*]] = cir.sub %[[MUL_AI_BR]], %[[MUL_AR_BI]] : !cir.double -// CIR-AFTER-PROMOTED: %[[RESULT_IMAG:.*]] = cir.div %[[SUB_AIBR_ARBI]], %[[ADD_BRBR_BIBI]] : !cir.double +// CIR-AFTER-PROMOTED: %[[MUL_AR_BR:.*]] = cir.fmul %[[A_REAL_F64]], %[[B_REAL_F64]] : !cir.double +// CIR-AFTER-PROMOTED: %[[MUL_AI_BI:.*]] = cir.fmul %[[A_IMAG_F64]], %[[B_IMAG_F64]] : !cir.double +// CIR-AFTER-PROMOTED: %[[MUL_BR_BR:.*]] = cir.fmul %[[B_REAL_F64]], %[[B_REAL_F64]] : !cir.double +// CIR-AFTER-PROMOTED: %[[MUL_BI_BI:.*]] = cir.fmul %[[B_IMAG_F64]], %[[B_IMAG_F64]] : !cir.double +// CIR-AFTER-PROMOTED: %[[ADD_ARBR_AIBI:.*]] = cir.fadd %[[MUL_AR_BR]], %[[MUL_AI_BI]] : !cir.double +// CIR-AFTER-PROMOTED: %[[ADD_BRBR_BIBI:.*]] = cir.fadd %[[MUL_BR_BR]], %[[MUL_BI_BI]] : !cir.double +// CIR-AFTER-PROMOTED: %[[RESULT_REAL:.*]] = cir.fdiv %[[ADD_ARBR_AIBI]], %[[ADD_BRBR_BIBI]] : !cir.double +// CIR-AFTER-PROMOTED: %[[MUL_AI_BR:.*]] = cir.fmul %[[A_IMAG_F64]], %[[B_REAL_F64]] : !cir.double +// CIR-AFTER-PROMOTED: %[[MUL_AR_BI:.*]] = cir.fmul %[[A_REAL_F64]], %[[B_IMAG_F64]] : !cir.double +// CIR-AFTER-PROMOTED: %[[SUB_AIBR_ARBI:.*]] = cir.fsub %[[MUL_AI_BR]], %[[MUL_AR_BI]] : !cir.double +// CIR-AFTER-PROMOTED: %[[RESULT_IMAG:.*]] = cir.fdiv %[[SUB_AIBR_ARBI]], %[[ADD_BRBR_BIBI]] : !cir.double // CIR-AFTER-PROMOTED: %[[RESULT_F64:.*]] = cir.complex.create %[[RESULT_REAL]], %[[RESULT_IMAG]] : !cir.double -> !cir.complex // CIR-AFTER-PROMOTED: %[[RESULT_REAL_F64:.*]] = cir.complex.real %[[RESULT_F64]] : !cir.complex -> !cir.double // CIR-AFTER-PROMOTED: %[[RESULT_IMAG_F64:.*]] = cir.complex.imag %[[RESULT_F64]] : !cir.complex -> !cir.double diff --git a/clang/test/CIR/CodeGen/variable-decomposition.cpp b/clang/test/CIR/CodeGen/variable-decomposition.cpp index 569f36bf753de..7d853ed28a020 100644 --- a/clang/test/CIR/CodeGen/variable-decomposition.cpp +++ b/clang/test/CIR/CodeGen/variable-decomposition.cpp @@ -29,7 +29,7 @@ float function() { // CIR: %[[CAST_A:.+]] = cir.cast int_to_float %[[LOAD_A]] : !s32i -> !cir.float // CIR: %[[MEMBER_B:.+]] = cir.get_member %[[STRUCT]][1] {name = "b"} : !cir.ptr -> !cir.ptr // CIR: %[[LOAD_B:.+]] = cir.load align(4) %[[MEMBER_B]] : !cir.ptr, !cir.float -// CIR: %[[ADD:.+]] = cir.add %[[CAST_A]], %[[LOAD_B]] : !cir.float +// CIR: %[[ADD:.+]] = cir.fadd %[[CAST_A]], %[[LOAD_B]] : !cir.float // CIR: cir.store %[[ADD]], %[[RETVAL]] : !cir.float, !cir.ptr // CIR: %[[RET:.+]] = cir.load %[[RETVAL]] : !cir.ptr, !cir.float // CIR: cir.return %[[RET]] : !cir.float diff --git a/clang/test/CIR/CodeGen/vector-ext.cpp b/clang/test/CIR/CodeGen/vector-ext.cpp index 3f8dc59988667..071af4911ee47 100644 --- a/clang/test/CIR/CodeGen/vector-ext.cpp +++ b/clang/test/CIR/CodeGen/vector-ext.cpp @@ -1270,7 +1270,7 @@ void foo24() { // CIR: %[[TMP_A_F16:.*]] = cir.cast floating %[[TMP_A]] : !cir.vector<4 x !cir.f16> -> !cir.vector<4 x !cir.float> // CIR: %[[TMP_B:.*]] = cir.load{{.*}} %[[B_ADDR]] : !cir.ptr>, !cir.vector<4 x !cir.f16> // CIR: %[[TMP_B_F16:.*]] = cir.cast floating %[[TMP_B]] : !cir.vector<4 x !cir.f16> -> !cir.vector<4 x !cir.float> -// CIR: %[[RESULT:.*]] = cir.add %[[TMP_A_F16]], %[[TMP_B_F16]] : !cir.vector<4 x !cir.float> +// CIR: %[[RESULT:.*]] = cir.fadd %[[TMP_A_F16]], %[[TMP_B_F16]] : !cir.vector<4 x !cir.float> // CIR: %[[RESULT_VF16:.*]] = cir.cast floating %[[RESULT]] : !cir.vector<4 x !cir.float> -> !cir.vector<4 x !cir.f16> // CIR: cir.store{{.*}} %[[RESULT_VF16]], %[[C_ADDR]] : !cir.vector<4 x !cir.f16>, !cir.ptr> diff --git a/clang/test/CIR/CodeGen/vector.cpp b/clang/test/CIR/CodeGen/vector.cpp index fe63c776818d6..b0f50cc63d1db 100644 --- a/clang/test/CIR/CodeGen/vector.cpp +++ b/clang/test/CIR/CodeGen/vector.cpp @@ -1312,7 +1312,7 @@ void foo27() { // CIR: %[[TMP_A_F16:.*]] = cir.cast floating %[[TMP_A]] : !cir.vector<4 x !cir.f16> -> !cir.vector<4 x !cir.float> // CIR: %[[TMP_B:.*]] = cir.load{{.*}} %[[B_ADDR]] : !cir.ptr>, !cir.vector<4 x !cir.f16> // CIR: %[[TMP_B_F16:.*]] = cir.cast floating %[[TMP_B]] : !cir.vector<4 x !cir.f16> -> !cir.vector<4 x !cir.float> -// CIR: %[[RESULT:.*]] = cir.add %[[TMP_A_F16]], %[[TMP_B_F16]] : !cir.vector<4 x !cir.float> +// CIR: %[[RESULT:.*]] = cir.fadd %[[TMP_A_F16]], %[[TMP_B_F16]] : !cir.vector<4 x !cir.float> // CIR: %[[RESULT_VF16:.*]] = cir.cast floating %[[RESULT]] : !cir.vector<4 x !cir.float> -> !cir.vector<4 x !cir.f16> // CIR: cir.store{{.*}} %[[RESULT_VF16]], %[[C_ADDR]] : !cir.vector<4 x !cir.f16>, !cir.ptr> diff --git a/clang/test/CIR/CodeGenOpenACC/atomic-capture.cpp b/clang/test/CIR/CodeGenOpenACC/atomic-capture.cpp index 687cbd73e16fc..1900377be796d 100644 --- a/clang/test/CIR/CodeGenOpenACC/atomic-capture.cpp +++ b/clang/test/CIR/CodeGenOpenACC/atomic-capture.cpp @@ -103,10 +103,10 @@ void use(int x, int v, float f, HasOps ops) { // CHECK-NEXT: %[[F_LOAD:.*]] = cir.load{{.*}} %[[F_ALLOCA]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[ONE_INT:.*]] = cir.const #cir.int<1> : !s32i // CHECK-NEXT: %[[ONE_CAST:.*]] = cir.cast int_to_float %[[ONE_INT]] : !s32i -> !cir.float - // CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[F_LOAD]], %[[ONE_CAST]] : !cir.float + // CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[F_LOAD]], %[[ONE_CAST]] : !cir.float // CHECK-NEXT: %[[X_VAR_LOAD:.*]] = cir.load{{.*}} %[[X_VAR_ALLOC]] : !cir.ptr, !s32i // CHECK-NEXT: %[[X_CAST:.*]] = cir.cast int_to_float %[[X_VAR_LOAD]] : !s32i -> !cir.float - // CHECK-NEXT: %[[ADD:.*]] = cir.add %[[X_CAST]], %[[MUL]] : !cir.float + // CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[X_CAST]], %[[MUL]] : !cir.float // CHECK-NEXT: %[[INT_CAST:.*]] = cir.cast float_to_int %[[ADD]] : !cir.float -> !s32i // CHECK-NEXT: cir.store{{.*}} %[[INT_CAST]], %[[X_VAR_ALLOC]] : !s32i, !cir.ptr // @@ -129,8 +129,8 @@ void use(int x, int v, float f, HasOps ops) { // CHECK-NEXT: %[[F_LOAD:.*]] = cir.load{{.*}} %[[F_ALLOCA]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[ONE_INT:.*]] = cir.const #cir.int<1> : !s32i // CHECK-NEXT: %[[ONE_CAST:.*]] = cir.cast int_to_float %[[ONE_INT]] : !s32i -> !cir.float - // CHECK-NEXT: %[[ADD:.*]] = cir.add %[[F_LOAD]], %[[ONE_CAST]] : !cir.float - // CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[X_CAST]], %[[ADD]] : !cir.float + // CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[F_LOAD]], %[[ONE_CAST]] : !cir.float + // CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[X_CAST]], %[[ADD]] : !cir.float // CHECK-NEXT: %[[INT_CAST:.*]] = cir.cast float_to_int %[[MUL]] : !cir.float -> !s32i // CHECK-NEXT: cir.store{{.*}} %[[INT_CAST]], %[[X_VAR_ALLOC]] : !s32i, !cir.ptr // @@ -151,10 +151,10 @@ void use(int x, int v, float f, HasOps ops) { // CHECK-NEXT: %[[F_LOAD:.*]] = cir.load{{.*}} %[[F_ALLOCA]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[ONE_INT:.*]] = cir.const #cir.int<1> : !s32i // CHECK-NEXT: %[[ONE_CAST:.*]] = cir.cast int_to_float %[[ONE_INT]] : !s32i -> !cir.float - // CHECK-NEXT: %[[ADD:.*]] = cir.add %[[F_LOAD]], %[[ONE_CAST]] : !cir.float + // CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[F_LOAD]], %[[ONE_CAST]] : !cir.float // CHECK-NEXT: %[[X_VAR_LOAD:.*]] = cir.load{{.*}} %[[X_VAR_ALLOC]] : !cir.ptr, !s32i // CHECK-NEXT: %[[X_CAST:.*]] = cir.cast int_to_float %[[X_VAR_LOAD]] : !s32i -> !cir.float - // CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[ADD]], %[[X_CAST]] : !cir.float + // CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[ADD]], %[[X_CAST]] : !cir.float // CHECK-NEXT: %[[INT_CAST:.*]] = cir.cast float_to_int %[[MUL]] : !cir.float -> !s32i // CHECK-NEXT: cir.store{{.*}} %[[INT_CAST]], %[[X_VAR_ALLOC]] : !s32i, !cir.ptr // @@ -176,10 +176,10 @@ void use(int x, int v, float f, HasOps ops) { // CHECK-NEXT: %[[F_LOAD:.*]] = cir.load{{.*}} %[[F_ALLOCA]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[ONE_INT:.*]] = cir.const #cir.int<1> : !s32i // CHECK-NEXT: %[[ONE_CAST:.*]] = cir.cast int_to_float %[[ONE_INT]] : !s32i -> !cir.float - // CHECK-NEXT: %[[ADD:.*]] = cir.add %[[F_LOAD]], %[[ONE_CAST]] : !cir.float + // CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[F_LOAD]], %[[ONE_CAST]] : !cir.float // CHECK-NEXT: %[[X_VAR_LOAD:.*]] = cir.load{{.*}} %[[X_VAR_ALLOC]] : !cir.ptr, !s32i // CHECK-NEXT: %[[X_CAST:.*]] = cir.cast int_to_float %[[X_VAR_LOAD]] : !s32i -> !cir.float - // CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[X_CAST]], %[[ADD]] : !cir.float + // CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[X_CAST]], %[[ADD]] : !cir.float // CHECK-NEXT: %[[INT_CAST:.*]] = cir.cast float_to_int %[[MUL]] : !cir.float -> !s32i // CHECK-NEXT: cir.store{{.*}} %[[INT_CAST]], %[[X_VAR_ALLOC]] : !s32i, !cir.ptr // @@ -201,10 +201,10 @@ void use(int x, int v, float f, HasOps ops) { // CHECK-NEXT: %[[F_LOAD:.*]] = cir.load{{.*}} %[[F_ALLOCA]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[ONE_INT:.*]] = cir.const #cir.int<1> : !s32i // CHECK-NEXT: %[[ONE_CAST:.*]] = cir.cast int_to_float %[[ONE_INT]] : !s32i -> !cir.float - // CHECK-NEXT: %[[ADD:.*]] = cir.add %[[F_LOAD]], %[[ONE_CAST]] : !cir.float + // CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[F_LOAD]], %[[ONE_CAST]] : !cir.float // CHECK-NEXT: %[[X_VAR_LOAD:.*]] = cir.load{{.*}} %[[X_VAR_ALLOC]] : !cir.ptr, !s32i // CHECK-NEXT: %[[X_CAST:.*]] = cir.cast int_to_float %[[X_VAR_LOAD]] : !s32i -> !cir.float - // CHECK-NEXT: %[[SUB:.*]] = cir.sub %[[X_CAST]], %[[ADD]] : !cir.float + // CHECK-NEXT: %[[SUB:.*]] = cir.fsub %[[X_CAST]], %[[ADD]] : !cir.float // CHECK-NEXT: %[[INT_CAST:.*]] = cir.cast float_to_int %[[SUB]] : !cir.float -> !s32i // CHECK-NEXT: cir.store{{.*}} %[[INT_CAST]], %[[X_VAR_ALLOC]] : !s32i, !cir.ptr // @@ -231,8 +231,8 @@ void use(int x, int v, float f, HasOps ops) { // CHECK-NEXT: %[[F_LOAD:.*]] = cir.load{{.*}} %[[F_ALLOCA]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[ONE_INT:.*]] = cir.const #cir.int<1> : !s32i // CHECK-NEXT: %[[ONE_CAST:.*]] = cir.cast int_to_float %[[ONE_INT]] : !s32i -> !cir.float - // CHECK-NEXT: %[[ADD:.*]] = cir.add %[[F_LOAD]], %[[ONE_CAST]] : !cir.float - // CHECK-NEXT: %[[DIV:.*]] = cir.div %[[X_CAST]], %[[ADD]] : !cir.float + // CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[F_LOAD]], %[[ONE_CAST]] : !cir.float + // CHECK-NEXT: %[[DIV:.*]] = cir.fdiv %[[X_CAST]], %[[ADD]] : !cir.float // CHECK-NEXT: %[[INT_CAST:.*]] = cir.cast float_to_int %[[DIV]] : !cir.float -> !s32i // CHECK-NEXT: cir.store{{.*}} %[[INT_CAST]], %[[X_VAR_ALLOC]] : !s32i, !cir.ptr // @@ -255,10 +255,10 @@ void use(int x, int v, float f, HasOps ops) { // // CHECK-NEXT: %[[F_LOAD:.*]] = cir.load{{.*}} %[[F_ALLOCA]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[OPS_CONV:.*]] = cir.call @{{.*}}(%[[OPS_ALLOCA]]) : (!cir.ptr {{.*}}) -> (!cir.float{{.*}}) - // CHECK-NEXT: %[[ADD:.*]] = cir.add %[[F_LOAD]], %[[OPS_CONV]] : !cir.float + // CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[F_LOAD]], %[[OPS_CONV]] : !cir.float // CHECK-NEXT: %[[X_VAR_LOAD:.*]] = cir.load{{.*}} %[[X_VAR_ALLOC]] : !cir.ptr, !s32i // CHECK-NEXT: %[[X_CAST:.*]] = cir.cast int_to_float %[[X_VAR_LOAD]] : !s32i -> !cir.float - // CHECK-NEXT: %[[DIV:.*]] = cir.div %[[ADD]], %[[X_CAST]] : !cir.float + // CHECK-NEXT: %[[DIV:.*]] = cir.fdiv %[[ADD]], %[[X_CAST]] : !cir.float // CHECK-NEXT: %[[INT_CAST:.*]] = cir.cast float_to_int %[[DIV]] : !cir.float -> !s32i // CHECK-NEXT: cir.store{{.*}} %[[INT_CAST]], %[[X_VAR_ALLOC]] : !s32i, !cir.ptr // @@ -283,8 +283,8 @@ void use(int x, int v, float f, HasOps ops) { // CHECK-NEXT: %[[F_LOAD:.*]] = cir.load{{.*}} %[[F_ALLOCA]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[ONE_INT:.*]] = cir.const #cir.int<1> : !s32i // CHECK-NEXT: %[[ONE_CAST:.*]] = cir.cast int_to_float %[[ONE_INT]] : !s32i -> !cir.float - // CHECK-NEXT: %[[ADD:.*]] = cir.add %[[F_LOAD]], %[[ONE_CAST]] : !cir.float - // CHECK-NEXT: %[[DIV:.*]] = cir.div %[[X_CAST]], %[[ADD]] : !cir.float + // CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[F_LOAD]], %[[ONE_CAST]] : !cir.float + // CHECK-NEXT: %[[DIV:.*]] = cir.fdiv %[[X_CAST]], %[[ADD]] : !cir.float // CHECK-NEXT: %[[INT_CAST:.*]] = cir.cast float_to_int %[[DIV]] : !cir.float -> !s32i // CHECK-NEXT: cir.store{{.*}} %[[INT_CAST]], %[[X_VAR_ALLOC]] : !s32i, !cir.ptr // @@ -307,10 +307,10 @@ void use(int x, int v, float f, HasOps ops) { // // CHECK-NEXT: %[[F_LOAD:.*]] = cir.load{{.*}} %[[F_ALLOCA]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[OPS_CONV:.*]] = cir.call @{{.*}}(%[[OPS_ALLOCA]]) : (!cir.ptr {{.*}}) -> (!cir.float{{.*}}) - // CHECK-NEXT: %[[ADD:.*]] = cir.add %[[F_LOAD]], %[[OPS_CONV]] : !cir.float + // CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[F_LOAD]], %[[OPS_CONV]] : !cir.float // CHECK-NEXT: %[[X_VAR_LOAD:.*]] = cir.load{{.*}} %[[X_VAR_ALLOC]] : !cir.ptr, !s32i // CHECK-NEXT: %[[X_CAST:.*]] = cir.cast int_to_float %[[X_VAR_LOAD]] : !s32i -> !cir.float - // CHECK-NEXT: %[[DIV:.*]] = cir.div %[[ADD]], %[[X_CAST]] : !cir.float + // CHECK-NEXT: %[[DIV:.*]] = cir.fdiv %[[ADD]], %[[X_CAST]] : !cir.float // CHECK-NEXT: %[[INT_CAST:.*]] = cir.cast float_to_int %[[DIV]] : !cir.float -> !s32i // CHECK-NEXT: cir.store{{.*}} %[[INT_CAST]], %[[X_VAR_ALLOC]] : !s32i, !cir.ptr // diff --git a/clang/test/CIR/CodeGenOpenACC/atomic-update.cpp b/clang/test/CIR/CodeGenOpenACC/atomic-update.cpp index 65db274222d6a..f1f11259c65c2 100644 --- a/clang/test/CIR/CodeGenOpenACC/atomic-update.cpp +++ b/clang/test/CIR/CodeGenOpenACC/atomic-update.cpp @@ -69,7 +69,7 @@ void use(int x, unsigned int y, float f, HasOps ops) { // CHECK-NEXT: %[[F_LOAD:.*]] = cir.load{{.*}} %[[F_ALLOCA]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[TEMP_LOAD:.*]] = cir.load{{.*}} %[[TEMP_ALLOCA]] : !cir.ptr, !s32i // CHECK-NEXT: %[[INT_TO_F:.*]] = cir.cast int_to_float %[[TEMP_LOAD]] : !s32i -> !cir.float - // CHECK-NEXT: %[[ADD:.*]] = cir.add %[[INT_TO_F]], %[[F_LOAD]] : !cir.float + // CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[INT_TO_F]], %[[F_LOAD]] : !cir.float // CHECK-NEXT: %[[F_TO_INT:.*]] = cir.cast float_to_int %[[ADD]] : !cir.float -> !s32i // CHECK-NEXT: cir.store{{.*}} %[[F_TO_INT]], %[[TEMP_ALLOCA]] : !s32i, !cir.ptr // @@ -87,7 +87,7 @@ void use(int x, unsigned int y, float f, HasOps ops) { // CHECK-NEXT: %[[Y_LOAD:.*]] = cir.load{{.*}} %[[Y_ALLOCA]] : !cir.ptr, !u32i // CHECK-NEXT: %[[INT_TO_F:.*]] = cir.cast int_to_float %[[Y_LOAD]] : !u32i -> !cir.float // CHECK-NEXT: %[[TEMP_LOAD:.*]] = cir.load{{.*}} %[[TEMP_ALLOCA]] : !cir.ptr, !cir.float - // CHECK-NEXT: %[[DIV:.*]] = cir.div %[[TEMP_LOAD]], %[[INT_TO_F]] : !cir.float + // CHECK-NEXT: %[[DIV:.*]] = cir.fdiv %[[TEMP_LOAD]], %[[INT_TO_F]] : !cir.float // CHECK-NEXT: cir.store{{.*}} %[[DIV]], %[[TEMP_ALLOCA]] : !cir.float, !cir.ptr // // CHECK-NEXT: %[[TEMP_LOAD:.*]] = cir.load{{.*}} %[[TEMP_ALLOCA]] : !cir.ptr, !cir.float @@ -140,7 +140,7 @@ void use(int x, unsigned int y, float f, HasOps ops) { // // CHECK-NEXT: %[[TEMP_LOAD:.*]] = cir.load{{.*}} %[[TEMP_ALLOCA]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[CALL:.*]] = cir.call {{.*}}(%[[OPS_ALLOCA]]) : (!cir.ptr {{.*}}) -> (!cir.float{{.*}}) - // CHECK-NEXT: %[[SUB:.*]] = cir.sub %[[TEMP_LOAD]], %[[CALL]] : !cir.float + // CHECK-NEXT: %[[SUB:.*]] = cir.fsub %[[TEMP_LOAD]], %[[CALL]] : !cir.float // CHECK-NEXT: cir.store{{.*}} %[[SUB]], %[[TEMP_ALLOCA]] : !cir.float, !cir.ptr // // CHECK-NEXT: %[[TEMP_LOAD:.*]] = cir.load{{.*}} %[[TEMP_ALLOCA]] : !cir.ptr, !cir.float diff --git a/clang/test/CIR/CodeGenOpenACC/atomic-write.cpp b/clang/test/CIR/CodeGenOpenACC/atomic-write.cpp index 8c903ac8ce8eb..7fd3b3aac4058 100644 --- a/clang/test/CIR/CodeGenOpenACC/atomic-write.cpp +++ b/clang/test/CIR/CodeGenOpenACC/atomic-write.cpp @@ -22,7 +22,7 @@ void use(int x, unsigned int y, float f, ConvertsToScalar cts) { // CHECK-NEXT: %[[Y_LOAD:.*]] = cir.load {{.*}}%[[Y_ALLOC]] : !cir.ptr, !u32i // CHECK-NEXT: %[[Y_TO_FLOAT:.*]] = cir.cast int_to_float %[[Y_LOAD]] : !u32i -> !cir.float // CHECK-NEXT: %[[F_LOAD:.*]] = cir.load {{.*}}%[[F_ALLOC]] : !cir.ptr, !cir.float - // CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[Y_TO_FLOAT]], %[[F_LOAD]] : !cir.float + // CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[Y_TO_FLOAT]], %[[F_LOAD]] : !cir.float // CHECK-NEXT: %[[RHS_CAST:.*]] = cir.cast float_to_int %[[MUL]] : !cir.float -> !s32i // CHECK-NEXT: acc.atomic.write %[[X_ALLOC]] = %[[RHS_CAST]] : !cir.ptr, !s32i #pragma acc atomic write diff --git a/clang/test/CIR/CodeGenOpenACC/combined-reduction-clause-default-ops.cpp b/clang/test/CIR/CodeGenOpenACC/combined-reduction-clause-default-ops.cpp index c3a787f32e085..39a933807a283 100644 --- a/clang/test/CIR/CodeGenOpenACC/combined-reduction-clause-default-ops.cpp +++ b/clang/test/CIR/CodeGenOpenACC/combined-reduction-clause-default-ops.cpp @@ -47,13 +47,13 @@ void acc_combined() { // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHSARG]][2] {name = "f"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[GET_MEM_LHS]] : !cir.float, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHSARG]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHSARG]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.double // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.double -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[GET_MEM_LHS]] : !cir.double, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHSARG]][4] {name = "b"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHSARG]][4] {name = "b"} : !cir.ptr -> !cir.ptr @@ -93,13 +93,13 @@ void acc_combined() { // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHSARG]][2] {name = "f"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[GET_MEM_LHS]] : !cir.float, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHSARG]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHSARG]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.double // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.double -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[GET_MEM_LHS]] : !cir.double, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHSARG]][4] {name = "b"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHSARG]][4] {name = "b"} : !cir.ptr -> !cir.ptr @@ -595,13 +595,13 @@ void acc_combined() { // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][2] {name = "f"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[GET_MEM_LHS]] : !cir.float, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.double // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.double -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[GET_MEM_LHS]] : !cir.double, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr @@ -664,13 +664,13 @@ void acc_combined() { // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][2] {name = "f"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[GET_MEM_LHS]] : !cir.float, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.double // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.double -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[GET_MEM_LHS]] : !cir.double, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr @@ -1373,13 +1373,13 @@ void acc_combined() { // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][2] {name = "f"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[GET_MEM_LHS]] : !cir.float, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.double // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.double -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[GET_MEM_LHS]] : !cir.double, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr @@ -1479,13 +1479,13 @@ void acc_combined() { // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][2] {name = "f"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[GET_MEM_LHS]] : !cir.float, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.double // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.double -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[GET_MEM_LHS]] : !cir.double, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr diff --git a/clang/test/CIR/CodeGenOpenACC/combined-reduction-clause-float.cpp b/clang/test/CIR/CodeGenOpenACC/combined-reduction-clause-float.cpp index c96e9d9e0b16f..33db4f5b146c2 100644 --- a/clang/test/CIR/CodeGenOpenACC/combined-reduction-clause-float.cpp +++ b/clang/test/CIR/CodeGenOpenACC/combined-reduction-clause-float.cpp @@ -17,7 +17,7 @@ void acc_combined() { // CHECK-NEXT: ^bb0(%[[LHSARG:.*]]: !cir.ptr {{.*}}, %[[RHSARG:.*]]: !cir.ptr {{.*}}) // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load {{.*}} %[[RHSARG]] : !cir.ptr // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load {{.*}} %[[LHSARG]] : !cir.ptr -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[LHSARG]] // CHECK-NEXT: acc.yield %[[LHSARG]] : !cir.ptr // CHECK-NEXT: } @@ -33,7 +33,7 @@ void acc_combined() { // CHECK-NEXT: ^bb0(%[[LHSARG:.*]]: !cir.ptr {{.*}}, %[[RHSARG:.*]]: !cir.ptr {{.*}}) // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load {{.*}} %[[RHSARG]] : !cir.ptr // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load {{.*}} %[[LHSARG]] : !cir.ptr -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[LHSARG]] // CHECK-NEXT: acc.yield %[[LHSARG]] : !cir.ptr // CHECK-NEXT: } @@ -161,7 +161,7 @@ void acc_combined() { // CHECK-NEXT: %[[RHS_STRIDE:.*]] = cir.ptr_stride %[[RHS_DECAY]], %[[ITR_LOAD]] : (!cir.ptr, !s64i) -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load {{.*}} %[[RHS_STRIDE]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load {{.*}} %[[LHS_STRIDE]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[LHS_STRIDE]] // CHECK-NEXT: cir.yield // CHECK-NEXT: } step { @@ -199,7 +199,7 @@ void acc_combined() { // CHECK-NEXT: %[[RHS_STRIDE:.*]] = cir.ptr_stride %[[RHS_DECAY]], %[[ITR_LOAD]] : (!cir.ptr, !s64i) -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load {{.*}} %[[RHS_STRIDE]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load {{.*}} %[[LHS_STRIDE]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[LHS_STRIDE]] // CHECK-NEXT: cir.yield // CHECK-NEXT: } step { @@ -449,7 +449,7 @@ void acc_combined() { // CHECK-NEXT: %[[RHS_STRIDE:.*]] = cir.ptr_stride %[[RHS_DECAY]], %[[ITR_LOAD]] : (!cir.ptr, !u64i) -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load {{.*}} %[[RHS_STRIDE]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load {{.*}} %[[LHS_STRIDE]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[LHS_STRIDE]] // CHECK-NEXT: cir.yield // CHECK-NEXT: } step { @@ -513,7 +513,7 @@ void acc_combined() { // CHECK-NEXT: %[[RHS_STRIDE:.*]] = cir.ptr_stride %[[RHS_DECAY]], %[[ITR_LOAD]] : (!cir.ptr, !u64i) -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load {{.*}} %[[RHS_STRIDE]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load {{.*}} %[[LHS_STRIDE]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[LHS_STRIDE]] // CHECK-NEXT: cir.yield // CHECK-NEXT: } step { diff --git a/clang/test/CIR/CodeGenOpenACC/compute-reduction-clause-default-ops.c b/clang/test/CIR/CodeGenOpenACC/compute-reduction-clause-default-ops.c index 1257fef2615d9..77155dce887e5 100644 --- a/clang/test/CIR/CodeGenOpenACC/compute-reduction-clause-default-ops.c +++ b/clang/test/CIR/CodeGenOpenACC/compute-reduction-clause-default-ops.c @@ -47,13 +47,13 @@ void acc_compute() { // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHSARG]][2] {name = "f"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[GET_MEM_LHS]] : !cir.float, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHSARG]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHSARG]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.double // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.double -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[GET_MEM_LHS]] : !cir.double, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHSARG]][4] {name = "b"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHSARG]][4] {name = "b"} : !cir.ptr -> !cir.ptr @@ -94,13 +94,13 @@ void acc_compute() { // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHSARG]][2] {name = "f"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[GET_MEM_LHS]] : !cir.float, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHSARG]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHSARG]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.double // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.double -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[GET_MEM_LHS]] : !cir.double, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHSARG]][4] {name = "b"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHSARG]][4] {name = "b"} : !cir.ptr -> !cir.ptr @@ -615,13 +615,13 @@ void acc_compute() { // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][2] {name = "f"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[GET_MEM_LHS]] : !cir.float, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.double // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.double -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[GET_MEM_LHS]] : !cir.double, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr @@ -684,13 +684,13 @@ void acc_compute() { // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][2] {name = "f"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[GET_MEM_LHS]] : !cir.float, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.double // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.double -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[GET_MEM_LHS]] : !cir.double, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr @@ -1406,13 +1406,13 @@ void acc_compute() { // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][2] {name = "f"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[GET_MEM_LHS]] : !cir.float, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.double // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.double -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[GET_MEM_LHS]] : !cir.double, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr @@ -1512,13 +1512,13 @@ void acc_compute() { // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][2] {name = "f"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[GET_MEM_LHS]] : !cir.float, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.double // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.double -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[GET_MEM_LHS]] : !cir.double, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr diff --git a/clang/test/CIR/CodeGenOpenACC/compute-reduction-clause-default-ops.cpp b/clang/test/CIR/CodeGenOpenACC/compute-reduction-clause-default-ops.cpp index dae634cd8bb58..1335bef8e85cf 100644 --- a/clang/test/CIR/CodeGenOpenACC/compute-reduction-clause-default-ops.cpp +++ b/clang/test/CIR/CodeGenOpenACC/compute-reduction-clause-default-ops.cpp @@ -47,13 +47,13 @@ void acc_compute() { // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHSARG]][2] {name = "f"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[GET_MEM_LHS]] : !cir.float, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHSARG]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHSARG]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.double // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.double -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[GET_MEM_LHS]] : !cir.double, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHSARG]][4] {name = "b"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHSARG]][4] {name = "b"} : !cir.ptr -> !cir.ptr @@ -93,13 +93,13 @@ void acc_compute() { // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHSARG]][2] {name = "f"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[GET_MEM_LHS]] : !cir.float, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHSARG]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHSARG]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.double // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.double -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[GET_MEM_LHS]] : !cir.double, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHSARG]][4] {name = "b"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHSARG]][4] {name = "b"} : !cir.ptr -> !cir.ptr @@ -595,13 +595,13 @@ void acc_compute() { // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][2] {name = "f"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[GET_MEM_LHS]] : !cir.float, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.double // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.double -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[GET_MEM_LHS]] : !cir.double, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr @@ -664,13 +664,13 @@ void acc_compute() { // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][2] {name = "f"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[GET_MEM_LHS]] : !cir.float, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.double // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.double -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[GET_MEM_LHS]] : !cir.double, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr @@ -1373,13 +1373,13 @@ void acc_compute() { // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][2] {name = "f"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[GET_MEM_LHS]] : !cir.float, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.double // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.double -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[GET_MEM_LHS]] : !cir.double, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr @@ -1479,13 +1479,13 @@ void acc_compute() { // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][2] {name = "f"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[GET_MEM_LHS]] : !cir.float, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.double // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.double -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[GET_MEM_LHS]] : !cir.double, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr diff --git a/clang/test/CIR/CodeGenOpenACC/compute-reduction-clause-float.c b/clang/test/CIR/CodeGenOpenACC/compute-reduction-clause-float.c index 035c72424b68e..b1bdbb44fa9d5 100644 --- a/clang/test/CIR/CodeGenOpenACC/compute-reduction-clause-float.c +++ b/clang/test/CIR/CodeGenOpenACC/compute-reduction-clause-float.c @@ -16,7 +16,7 @@ void acc_compute() { // CHECK-NEXT: ^bb0(%[[LHSARG:.*]]: !cir.ptr {{.*}}, %[[RHSARG:.*]]: !cir.ptr {{.*}}) // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load {{.*}} %[[RHSARG]] : !cir.ptr // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load {{.*}} %[[LHSARG]] : !cir.ptr -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[LHSARG]] // CHECK-NEXT: acc.yield %[[LHSARG]] : !cir.ptr // CHECK-NEXT: } @@ -32,7 +32,7 @@ void acc_compute() { // CHECK-NEXT: ^bb0(%[[LHSARG:.*]]: !cir.ptr {{.*}}, %[[RHSARG:.*]]: !cir.ptr {{.*}}) // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load {{.*}} %[[RHSARG]] : !cir.ptr // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load {{.*}} %[[LHSARG]] : !cir.ptr -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[LHSARG]] // CHECK-NEXT: acc.yield %[[LHSARG]] : !cir.ptr // CHECK-NEXT: } @@ -162,7 +162,7 @@ void acc_compute() { // CHECK-NEXT: %[[RHS_STRIDE:.*]] = cir.ptr_stride %[[RHS_DECAY]], %[[ITR_LOAD]] : (!cir.ptr, !s64i) -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load {{.*}} %[[RHS_STRIDE]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load {{.*}} %[[LHS_STRIDE]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[LHS_STRIDE]] // CHECK-NEXT: cir.yield // CHECK-NEXT: } step { @@ -200,7 +200,7 @@ void acc_compute() { // CHECK-NEXT: %[[RHS_STRIDE:.*]] = cir.ptr_stride %[[RHS_DECAY]], %[[ITR_LOAD]] : (!cir.ptr, !s64i) -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load {{.*}} %[[RHS_STRIDE]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load {{.*}} %[[LHS_STRIDE]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[LHS_STRIDE]] // CHECK-NEXT: cir.yield // CHECK-NEXT: } step { @@ -452,7 +452,7 @@ void acc_compute() { // CHECK-NEXT: %[[RHS_STRIDE:.*]] = cir.ptr_stride %[[RHS_DECAY]], %[[ITR_LOAD]] : (!cir.ptr, !u64i) -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load {{.*}} %[[RHS_STRIDE]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load {{.*}} %[[LHS_STRIDE]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[LHS_STRIDE]] // CHECK-NEXT: cir.yield // CHECK-NEXT: } step { @@ -516,7 +516,7 @@ void acc_compute() { // CHECK-NEXT: %[[RHS_STRIDE:.*]] = cir.ptr_stride %[[RHS_DECAY]], %[[ITR_LOAD]] : (!cir.ptr, !u64i) -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load {{.*}} %[[RHS_STRIDE]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load {{.*}} %[[LHS_STRIDE]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[LHS_STRIDE]] // CHECK-NEXT: cir.yield // CHECK-NEXT: } step { diff --git a/clang/test/CIR/CodeGenOpenACC/compute-reduction-clause-float.cpp b/clang/test/CIR/CodeGenOpenACC/compute-reduction-clause-float.cpp index 3b3beb395c74b..626d7efa38507 100644 --- a/clang/test/CIR/CodeGenOpenACC/compute-reduction-clause-float.cpp +++ b/clang/test/CIR/CodeGenOpenACC/compute-reduction-clause-float.cpp @@ -17,7 +17,7 @@ void acc_compute() { // CHECK-NEXT: ^bb0(%[[LHSARG:.*]]: !cir.ptr {{.*}}, %[[RHSARG:.*]]: !cir.ptr {{.*}}) // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load {{.*}} %[[RHSARG]] : !cir.ptr // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load {{.*}} %[[LHSARG]] : !cir.ptr -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[LHSARG]] // CHECK-NEXT: acc.yield %[[LHSARG]] : !cir.ptr // CHECK-NEXT: } @@ -33,7 +33,7 @@ void acc_compute() { // CHECK-NEXT: ^bb0(%[[LHSARG:.*]]: !cir.ptr {{.*}}, %[[RHSARG:.*]]: !cir.ptr {{.*}}) // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load {{.*}} %[[RHSARG]] : !cir.ptr // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load {{.*}} %[[LHSARG]] : !cir.ptr -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[LHSARG]] // CHECK-NEXT: acc.yield %[[LHSARG]] : !cir.ptr // CHECK-NEXT: } @@ -161,7 +161,7 @@ void acc_compute() { // CHECK-NEXT: %[[RHS_STRIDE:.*]] = cir.ptr_stride %[[RHS_DECAY]], %[[ITR_LOAD]] : (!cir.ptr, !s64i) -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load {{.*}} %[[RHS_STRIDE]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load {{.*}} %[[LHS_STRIDE]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[LHS_STRIDE]] // CHECK-NEXT: cir.yield // CHECK-NEXT: } step { @@ -199,7 +199,7 @@ void acc_compute() { // CHECK-NEXT: %[[RHS_STRIDE:.*]] = cir.ptr_stride %[[RHS_DECAY]], %[[ITR_LOAD]] : (!cir.ptr, !s64i) -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load {{.*}} %[[RHS_STRIDE]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load {{.*}} %[[LHS_STRIDE]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[LHS_STRIDE]] // CHECK-NEXT: cir.yield // CHECK-NEXT: } step { @@ -449,7 +449,7 @@ void acc_compute() { // CHECK-NEXT: %[[RHS_STRIDE:.*]] = cir.ptr_stride %[[RHS_DECAY]], %[[ITR_LOAD]] : (!cir.ptr, !u64i) -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load {{.*}} %[[RHS_STRIDE]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load {{.*}} %[[LHS_STRIDE]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[LHS_STRIDE]] // CHECK-NEXT: cir.yield // CHECK-NEXT: } step { @@ -513,7 +513,7 @@ void acc_compute() { // CHECK-NEXT: %[[RHS_STRIDE:.*]] = cir.ptr_stride %[[RHS_DECAY]], %[[ITR_LOAD]] : (!cir.ptr, !u64i) -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load {{.*}} %[[RHS_STRIDE]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load {{.*}} %[[LHS_STRIDE]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[LHS_STRIDE]] // CHECK-NEXT: cir.yield // CHECK-NEXT: } step { diff --git a/clang/test/CIR/CodeGenOpenACC/loop-reduction-clause-default-ops.cpp b/clang/test/CIR/CodeGenOpenACC/loop-reduction-clause-default-ops.cpp index b112571bf1f94..049205a6cf742 100644 --- a/clang/test/CIR/CodeGenOpenACC/loop-reduction-clause-default-ops.cpp +++ b/clang/test/CIR/CodeGenOpenACC/loop-reduction-clause-default-ops.cpp @@ -47,13 +47,13 @@ void acc_loop() { // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHSARG]][2] {name = "f"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[GET_MEM_LHS]] : !cir.float, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHSARG]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHSARG]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.double // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.double -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[GET_MEM_LHS]] : !cir.double, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHSARG]][4] {name = "b"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHSARG]][4] {name = "b"} : !cir.ptr -> !cir.ptr @@ -93,13 +93,13 @@ void acc_loop() { // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHSARG]][2] {name = "f"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[GET_MEM_LHS]] : !cir.float, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHSARG]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHSARG]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.double // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.double -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[GET_MEM_LHS]] : !cir.double, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHSARG]][4] {name = "b"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHSARG]][4] {name = "b"} : !cir.ptr -> !cir.ptr @@ -595,13 +595,13 @@ void acc_loop() { // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][2] {name = "f"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[GET_MEM_LHS]] : !cir.float, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.double // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.double -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[GET_MEM_LHS]] : !cir.double, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr @@ -664,13 +664,13 @@ void acc_loop() { // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][2] {name = "f"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[GET_MEM_LHS]] : !cir.float, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.double // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.double -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[GET_MEM_LHS]] : !cir.double, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr @@ -1373,13 +1373,13 @@ void acc_loop() { // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][2] {name = "f"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[GET_MEM_LHS]] : !cir.float, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.double // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.double -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[GET_MEM_LHS]] : !cir.double, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr @@ -1479,13 +1479,13 @@ void acc_loop() { // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][2] {name = "f"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[GET_MEM_LHS]] : !cir.float, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][3] {name = "d"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_RHS]] : !cir.ptr, !cir.double // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load{{.*}} %[[GET_MEM_LHS]] : !cir.ptr, !cir.double -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.double // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[GET_MEM_LHS]] : !cir.double, !cir.ptr // CHECK-NEXT: %[[GET_MEM_LHS:.*]] = cir.get_member %[[LHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr // CHECK-NEXT: %[[GET_MEM_RHS:.*]] = cir.get_member %[[RHS_STRIDE]][4] {name = "b"} : !cir.ptr -> !cir.ptr diff --git a/clang/test/CIR/CodeGenOpenACC/loop-reduction-clause-float.cpp b/clang/test/CIR/CodeGenOpenACC/loop-reduction-clause-float.cpp index 9eda370bafbdb..b926895e40b1c 100644 --- a/clang/test/CIR/CodeGenOpenACC/loop-reduction-clause-float.cpp +++ b/clang/test/CIR/CodeGenOpenACC/loop-reduction-clause-float.cpp @@ -17,7 +17,7 @@ void acc_loop() { // CHECK-NEXT: ^bb0(%[[LHSARG:.*]]: !cir.ptr {{.*}}, %[[RHSARG:.*]]: !cir.ptr {{.*}}) // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load {{.*}} %[[RHSARG]] : !cir.ptr // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load {{.*}} %[[LHSARG]] : !cir.ptr -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[LHSARG]] // CHECK-NEXT: acc.yield %[[LHSARG]] : !cir.ptr // CHECK-NEXT: } @@ -33,7 +33,7 @@ void acc_loop() { // CHECK-NEXT: ^bb0(%[[LHSARG:.*]]: !cir.ptr {{.*}}, %[[RHSARG:.*]]: !cir.ptr {{.*}}) // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load {{.*}} %[[RHSARG]] : !cir.ptr // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load {{.*}} %[[LHSARG]] : !cir.ptr -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[LHSARG]] // CHECK-NEXT: acc.yield %[[LHSARG]] : !cir.ptr // CHECK-NEXT: } @@ -161,7 +161,7 @@ void acc_loop() { // CHECK-NEXT: %[[RHS_STRIDE:.*]] = cir.ptr_stride %[[RHS_DECAY]], %[[ITR_LOAD]] : (!cir.ptr, !s64i) -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load {{.*}} %[[RHS_STRIDE]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load {{.*}} %[[LHS_STRIDE]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[LHS_STRIDE]] // CHECK-NEXT: cir.yield // CHECK-NEXT: } step { @@ -199,7 +199,7 @@ void acc_loop() { // CHECK-NEXT: %[[RHS_STRIDE:.*]] = cir.ptr_stride %[[RHS_DECAY]], %[[ITR_LOAD]] : (!cir.ptr, !s64i) -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load {{.*}} %[[RHS_STRIDE]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load {{.*}} %[[LHS_STRIDE]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[LHS_STRIDE]] // CHECK-NEXT: cir.yield // CHECK-NEXT: } step { @@ -449,7 +449,7 @@ void acc_loop() { // CHECK-NEXT: %[[RHS_STRIDE:.*]] = cir.ptr_stride %[[RHS_DECAY]], %[[ITR_LOAD]] : (!cir.ptr, !u64i) -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load {{.*}} %[[RHS_STRIDE]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load {{.*}} %[[LHS_STRIDE]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[ADD:.*]] = cir.add %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[ADD:.*]] = cir.fadd %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[ADD]], %[[LHS_STRIDE]] // CHECK-NEXT: cir.yield // CHECK-NEXT: } step { @@ -513,7 +513,7 @@ void acc_loop() { // CHECK-NEXT: %[[RHS_STRIDE:.*]] = cir.ptr_stride %[[RHS_DECAY]], %[[ITR_LOAD]] : (!cir.ptr, !u64i) -> !cir.ptr // CHECK-NEXT: %[[RHS_LOAD:.*]] = cir.load {{.*}} %[[RHS_STRIDE]] : !cir.ptr, !cir.float // CHECK-NEXT: %[[LHS_LOAD:.*]] = cir.load {{.*}} %[[LHS_STRIDE]] : !cir.ptr, !cir.float -// CHECK-NEXT: %[[MUL:.*]] = cir.mul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float +// CHECK-NEXT: %[[MUL:.*]] = cir.fmul %[[LHS_LOAD]], %[[RHS_LOAD]] : !cir.float // CHECK-NEXT: cir.store {{.*}} %[[MUL]], %[[LHS_STRIDE]] // CHECK-NEXT: cir.yield // CHECK-NEXT: } step { diff --git a/clang/test/CIR/Lowering/binop-fp.cir b/clang/test/CIR/Lowering/binop-fp.cir index a4d5daee0cc07..0aa8dc147ef6d 100644 --- a/clang/test/CIR/Lowering/binop-fp.cir +++ b/clang/test/CIR/Lowering/binop-fp.cir @@ -11,35 +11,35 @@ module { %5 = cir.alloca !cir.double, !cir.ptr, ["g", init] {alignment = 8 : i64} %6 = cir.load %0 : !cir.ptr, !cir.float %7 = cir.load %1 : !cir.ptr, !cir.float - %8 = cir.mul %6, %7 : !cir.float + %8 = cir.fmul %6, %7 : !cir.float cir.store %8, %2 : !cir.float, !cir.ptr %9 = cir.load %2 : !cir.ptr, !cir.float %10 = cir.load %1 : !cir.ptr, !cir.float - %11 = cir.div %9, %10 : !cir.float + %11 = cir.fdiv %9, %10 : !cir.float cir.store %11, %2 : !cir.float, !cir.ptr %12 = cir.load %2 : !cir.ptr, !cir.float %13 = cir.load %1 : !cir.ptr, !cir.float - %14 = cir.add %12, %13 : !cir.float + %14 = cir.fadd %12, %13 : !cir.float cir.store %14, %2 : !cir.float, !cir.ptr %15 = cir.load %2 : !cir.ptr, !cir.float %16 = cir.load %1 : !cir.ptr, !cir.float - %17 = cir.sub %15, %16 : !cir.float + %17 = cir.fsub %15, %16 : !cir.float cir.store %17, %2 : !cir.float, !cir.ptr %18 = cir.load %3 : !cir.ptr, !cir.double %19 = cir.load %4 : !cir.ptr, !cir.double - %20 = cir.add %18, %19 : !cir.double + %20 = cir.fadd %18, %19 : !cir.double cir.store %20, %5 : !cir.double, !cir.ptr %21 = cir.load %3 : !cir.ptr, !cir.double %22 = cir.load %4 : !cir.ptr, !cir.double - %23 = cir.sub %21, %22 : !cir.double + %23 = cir.fsub %21, %22 : !cir.double cir.store %23, %5 : !cir.double, !cir.ptr %24 = cir.load %3 : !cir.ptr, !cir.double %25 = cir.load %4 : !cir.ptr, !cir.double - %26 = cir.mul %24, %25 : !cir.double + %26 = cir.fmul %24, %25 : !cir.double cir.store %26, %5 : !cir.double, !cir.ptr %27 = cir.load %3 : !cir.ptr, !cir.double %28 = cir.load %4 : !cir.ptr, !cir.double - %29 = cir.div %27, %28 : !cir.double + %29 = cir.fdiv %27, %28 : !cir.double cir.store %29, %5 : !cir.double, !cir.ptr cir.return } diff --git a/clang/test/CodeGen/AArch64/neon/fullfp16.c b/clang/test/CodeGen/AArch64/neon/fullfp16.c index 895e05629abf5..fd73aa56a7751 100644 --- a/clang/test/CodeGen/AArch64/neon/fullfp16.c +++ b/clang/test/CodeGen/AArch64/neon/fullfp16.c @@ -38,7 +38,7 @@ //===------------------------------------------------------===// // ALL-LABEL: @test_vaddh_f16( float16_t test_vaddh_f16(float16_t a, float16_t b) { -// CIR: {{%.*}} = cir.add {{%.*}}, {{%.*}} : !cir.f16 +// CIR: {{%.*}} = cir.fadd {{%.*}}, {{%.*}} : !cir.f16 // LLVM-SAME: half {{.*}} [[A:%.*]], half{{.*}} [[B:%.*]]) {{.*}} { // LLVM: [[ADD:%.*]] = fadd half [[A]], [[B]] @@ -51,7 +51,7 @@ float16_t test_vaddh_f16(float16_t a, float16_t b) { //===------------------------------------------------------===// // ALL-LABEL: @test_vsubh_f16( float16_t test_vsubh_f16(float16_t a, float16_t b) { -// CIR: {{%.*}} = cir.sub {{%.*}}, {{%.*}} : !cir.f16 +// CIR: {{%.*}} = cir.fsub {{%.*}}, {{%.*}} : !cir.f16 // LLVM-SAME: half {{.*}} [[A:%.]], half {{.*}} [[B:%.]]) {{.*}} { // LLVM: [[SUB:%.*]] = fsub half [[A]], [[B]] @@ -64,7 +64,7 @@ float16_t test_vsubh_f16(float16_t a, float16_t b) { //===------------------------------------------------------===// // ALL-LABEL: @test_vmulh_f16( float16_t test_vmulh_f16(float16_t a, float16_t b) { -// CIR: {{%.*}} = cir.mul {{%.*}}, {{%.*}} : !cir.f16 +// CIR: {{%.*}} = cir.fmul {{%.*}}, {{%.*}} : !cir.f16 // LLVM-SAME: half {{.*}} [[A:%.]], half {{.*}} [[B:%.]]) {{.*}} { // LLVM: [[MUL:%.*]] = fmul half [[A]], [[B]] @@ -77,7 +77,7 @@ float16_t test_vmulh_f16(float16_t a, float16_t b) { //===------------------------------------------------------===// // ALL-LABEL: @test_vdivh_f16( float16_t test_vdivh_f16(float16_t a, float16_t b) { -// CIR: {{%.*}} = cir.div {{%.*}}, {{%.*}} : !cir.f16 +// CIR: {{%.*}} = cir.fdiv {{%.*}}, {{%.*}} : !cir.f16 // LLVM-SAME: half {{.*}} [[A:%.]], half {{.*}} [[B:%.]]) {{.*}} { // LLVM: [[DIV:%.*]] = fdiv half [[A]], [[B]]