Skip to content

Commit b31574a

Browse files
authored
Merge pull request #465 from Xilinx/bump_to_3494ee95
[AutoBump] Merge with fixes of 3494ee9 (Nov 01) (Needs downstream fixes) (8)
2 parents aeda3ee + f2c715b commit b31574a

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

llvm/include/llvm/ADT/APInt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class [[nodiscard]] APInt {
109109
/// \param implicitTrunc allow implicit truncation of non-zero/sign bits of
110110
/// val beyond the range of numBits
111111
APInt(unsigned numBits, uint64_t val, bool isSigned = false,
112-
bool implicitTrunc = true)
112+
bool implicitTrunc = false)
113113
: BitWidth(numBits) {
114114
if (!implicitTrunc) {
115115
if (isSigned) {

mlir/lib/Dialect/PDL/IR/Builtins.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ LogicalResult static unaryOp(PatternRewriter &rewriter, PDLResultList &results,
6363
? std::pow(2, operandIntAttr.getValue().getZExtValue())
6464
: std::pow(2, operandIntAttr.getValue().getSExtValue());
6565

66-
APInt resultInt(bitWidth, resultVal, integerType.isSigned());
66+
APInt resultInt(bitWidth, resultVal, integerType.isSigned(),
67+
/*implicitTrunc*/ true);
6768

6869
bool isOverflow = integerType.isSigned()
6970
? resultInt.slt(operandIntAttr.getValue())

mlir/lib/Dialect/Tosa/Transforms/TosaFolders.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,9 +1540,11 @@ struct TosaFoldConstantMatMul
15401540

15411541
// Convert int64_t to the correct output type.
15421542
std::vector<APInt> apintValues;
1543-
llvm::transform(values, std::back_inserter(apintValues),
1544-
[&](const int64_t &val) {
1545-
APInt apIntVal(baseType.getIntOrFloatBitWidth(), val);
1543+
llvm::transform(
1544+
values, std::back_inserter(apintValues), [&](const int64_t &val) {
1545+
APInt apIntVal(baseType.getIntOrFloatBitWidth(), val,
1546+
/*isSigned=*/true); // tosa-mlir uses signless
1547+
// instead of signed
15461548
return apIntVal;
15471549
});
15481550
return DenseElementsAttr::get(outputType, apintValues);

0 commit comments

Comments
 (0)