@@ -1608,28 +1608,28 @@ class CIR_BitOp<string mnemonic, TypeConstraint inputTy> : CIR_Op<mnemonic, [
1608
1608
let results = (outs inputTy:$result);
1609
1609
1610
1610
let assemblyFormat = [{
1611
- `(` $input `:` type($input) `)` `:` type($result) attr-dict
1611
+ $input `:` type($result) attr-dict
1612
1612
}];
1613
1613
}
1614
1614
1615
1615
class CIR_CountZerosBitOp<string mnemonic, TypeConstraint inputTy>
1616
1616
: CIR_BitOp<mnemonic, inputTy> {
1617
1617
let arguments = (ins inputTy:$input, UnitAttr:$is_zero_poison);
1618
1618
let assemblyFormat = [{
1619
- `(` $input `:` type($input) `)` (`zero_poison` $is_zero_poison^)?
1619
+ $input (`zero_poison` $is_zero_poison^)?
1620
1620
`:` type($result) attr-dict
1621
1621
}];
1622
1622
}
1623
1623
1624
- def CIR_BitClrsbOp : CIR_BitOp<"bit. clrsb", CIR_SIntOfWidths<[32, 64]>> {
1624
+ def CIR_BitClrsbOp : CIR_BitOp<"clrsb", CIR_SIntOfWidths<[32, 64]>> {
1625
1625
let summary = "Get the number of leading redundant sign bits in the input";
1626
1626
let description = [{
1627
1627
Compute the number of leading redundant sign bits in the input integer.
1628
1628
1629
1629
The input integer must be a signed integer. The most significant bit of the
1630
- input integer is the sign bit. The `cir.bit. clrsb` operation returns the
1631
- number of redundant sign bits in the input, that is, the number of bits
1632
- following the most significant bit that are identical to it.
1630
+ input integer is the sign bit. The `cir.clrsb` operation returns the number
1631
+ of redundant sign bits in the input, that is, the number of bits following
1632
+ the most significant bit that are identical to it.
1633
1633
1634
1634
The bit width of the input integer must be either 32 or 64.
1635
1635
@@ -1642,24 +1642,22 @@ def CIR_BitClrsbOp : CIR_BitOp<"bit.clrsb", CIR_SIntOfWidths<[32, 64]>> {
1642
1642
%0 = cir.const #cir.int<3735928559> : !s32i
1643
1643
// %1 will be 1 because there is 1 bit following the most significant bit
1644
1644
// that is identical to it.
1645
- %1 = cir.bit. clrsb(%0 : !s32i) : !s32i
1645
+ %1 = cir.clrsb(%0 : !s32i) : !s32i
1646
1646
1647
1647
// %2 = 1, 0b0000_0000_0000_0000_0000_0000_0000_0001
1648
1648
%2 = cir.const #cir.int<1> : !s32i
1649
1649
// %3 will be 30
1650
- %3 = cir.bit. clrsb(%2 : !s32i) : !s32i
1650
+ %3 = cir.clrsb(%2 : !s32i) : !s32i
1651
1651
```
1652
1652
}];
1653
1653
}
1654
1654
1655
- def CIR_BitClzOp : CIR_CountZerosBitOp<"bit.clz",
1656
- CIR_UIntOfWidths<[16, 32, 64]>
1657
- > {
1655
+ def CIR_BitClzOp : CIR_CountZerosBitOp<"clz", CIR_UIntOfWidths<[16, 32, 64]>> {
1658
1656
let summary = "Get the number of leading 0-bits in the input";
1659
1657
let description = [{
1660
1658
Compute the number of leading 0-bits in the input.
1661
1659
1662
- The input integer must be an unsigned integer. The `cir.bit. clz` operation
1660
+ The input integer must be an unsigned integer. The `cir.clz` operation
1663
1661
returns the number of consecutive 0-bits at the most significant bit
1664
1662
position in the input.
1665
1663
@@ -1674,19 +1672,17 @@ def CIR_BitClzOp : CIR_CountZerosBitOp<"bit.clz",
1674
1672
// %0 = 0b0000_0000_0000_0000_0000_0000_0000_1000
1675
1673
%0 = cir.const #cir.int<8> : !u32i
1676
1674
// %1 will be 28
1677
- %1 = cir.bit. clz(%0 : !u32i) zero_poison : !u32i
1675
+ %1 = cir.clz(%0 : !u32i) zero_poison : !u32i
1678
1676
```
1679
1677
}];
1680
1678
}
1681
1679
1682
- def CIR_BitCtzOp : CIR_CountZerosBitOp<"bit.ctz",
1683
- CIR_UIntOfWidths<[16, 32, 64]>
1684
- > {
1680
+ def CIR_BitCtzOp : CIR_CountZerosBitOp<"ctz", CIR_UIntOfWidths<[16, 32, 64]>> {
1685
1681
let summary = "Get the number of trailing 0-bits in the input";
1686
1682
let description = [{
1687
1683
Compute the number of trailing 0-bits in the input.
1688
1684
1689
- The input integer must be an unsigned integer. The `cir.bit. ctz` operation
1685
+ The input integer must be an unsigned integer. The `cir.ctz` operation
1690
1686
returns the number of consecutive 0-bits at the least significant bit
1691
1687
position in the input.
1692
1688
@@ -1702,20 +1698,19 @@ def CIR_BitCtzOp : CIR_CountZerosBitOp<"bit.ctz",
1702
1698
// %0 = 0b1000
1703
1699
%0 = cir.const #cir.int<8> : !u32i
1704
1700
// %1 will be 3
1705
- %1 = cir.bit. ctz(%0 : !u32i) : !u32i
1701
+ %1 = cir.ctz(%0 : !u32i) : !u32i
1706
1702
```
1707
1703
}];
1708
1704
}
1709
1705
1710
- def CIR_BitFfsOp : CIR_BitOp<"bit. ffs", CIR_SIntOfWidths<[32, 64]>> {
1706
+ def CIR_BitFfsOp : CIR_BitOp<"ffs", CIR_SIntOfWidths<[32, 64]>> {
1711
1707
let summary = "Get the position of the least significant 1-bit of input";
1712
1708
let description = [{
1713
1709
Compute the position of the least significant 1-bit of the input.
1714
1710
1715
- The input integer must be a signed integer. The `cir.bit.ffs` operation
1716
- returns one plus the index of the least significant 1-bit of the input
1717
- signed integer. As a special case, if the input integer is 0, `cir.bit.ffs`
1718
- returns 0.
1711
+ The input integer must be a signed integer. The `cir.ffs` operation returns
1712
+ one plus the index of the least significant 1-bit of the input signed
1713
+ integer. As a special case, if the input integer is 0, `cir.ffs` returns 0.
1719
1714
1720
1715
Example:
1721
1716
@@ -1725,12 +1720,12 @@ def CIR_BitFfsOp : CIR_BitOp<"bit.ffs", CIR_SIntOfWidths<[32, 64]>> {
1725
1720
// %0 = 0x0010_1000
1726
1721
%0 = cir.const #cir.int<40> : !s32i
1727
1722
// #1 will be 4 since the 4th least significant bit is 1.
1728
- %1 = cir.bit. ffs(%0 : !s32i) : !s32i
1723
+ %1 = cir.ffs(%0 : !s32i) : !s32i
1729
1724
```
1730
1725
}];
1731
1726
}
1732
1727
1733
- def CIR_BitParityOp : CIR_BitOp<"bit. parity", CIR_UIntOfWidths<[32, 64]>> {
1728
+ def CIR_BitParityOp : CIR_BitOp<"parity", CIR_UIntOfWidths<[32, 64]>> {
1734
1729
let summary = "Get the parity of input";
1735
1730
let description = [{
1736
1731
Compute the parity of the input. The parity of an integer is the number of
@@ -1747,14 +1742,12 @@ def CIR_BitParityOp : CIR_BitOp<"bit.parity", CIR_UIntOfWidths<[32, 64]>> {
1747
1742
// %0 = 0x0110_1000
1748
1743
%0 = cir.const #cir.int<104> : !u32i
1749
1744
// %1 will be 1 since there are 3 1-bits in %0
1750
- %1 = cir.bit. parity(%0 : !u32i) : !u32i
1745
+ %1 = cir.parity(%0 : !u32i) : !u32i
1751
1746
```
1752
1747
}];
1753
1748
}
1754
1749
1755
- def CIR_BitPopcountOp : CIR_BitOp<"bit.popcount",
1756
- CIR_UIntOfWidths<[16, 32, 64]>
1757
- > {
1750
+ def CIR_BitPopcountOp : CIR_BitOp<"popcount", CIR_UIntOfWidths<[16, 32, 64]>> {
1758
1751
let summary = "Get the number of 1-bits in input";
1759
1752
let description = [{
1760
1753
Compute the number of 1-bits in the input.
@@ -1769,7 +1762,7 @@ def CIR_BitPopcountOp : CIR_BitOp<"bit.popcount",
1769
1762
// %0 = 0x0110_1000
1770
1763
%0 = cir.const #cir.int<104> : !u32i
1771
1764
// %1 will be 3 since there are 3 1-bits in %0
1772
- %1 = cir.bit. popcount(%0 : !u32i) : !u32i
1765
+ %1 = cir.popcount(%0 : !u32i) : !u32i
1773
1766
```
1774
1767
}];
1775
1768
}
@@ -1778,11 +1771,11 @@ def CIR_BitPopcountOp : CIR_BitOp<"bit.popcount",
1778
1771
// ByteswapOp
1779
1772
//===----------------------------------------------------------------------===//
1780
1773
1781
- def CIR_ByteswapOp : CIR_Op<"bswap ", [Pure, SameOperandsAndResultType]> {
1774
+ def CIR_ByteswapOp : CIR_Op<"byte_swap ", [Pure, SameOperandsAndResultType]> {
1782
1775
let summary = "Reverse the bytes that constitute the operand integer";
1783
1776
let description = [{
1784
- The `cir.bswap ` operation takes an integer as operand, and returns it with
1785
- the order of bytes that constitute the operand reversed.
1777
+ The `cir.byte_swap ` operation takes an integer as operand, and returns it
1778
+ with the order of bytes that constitute the operand reversed.
1786
1779
1787
1780
The operand integer must be an unsigned integer. Its widths must be either
1788
1781
16, 32, or 64.
@@ -1796,15 +1789,15 @@ def CIR_ByteswapOp : CIR_Op<"bswap", [Pure, SameOperandsAndResultType]> {
1796
1789
%0 = cir.const #cir.int<305419896> : !u32i
1797
1790
1798
1791
// %1 should be 0x78563412
1799
- %1 = cir.bswap (%0 : !u32i) : !u32i
1792
+ %1 = cir.byte_swap (%0 : !u32i) : !u32i
1800
1793
```
1801
1794
}];
1802
1795
1803
1796
let results = (outs CIR_IntType:$result);
1804
1797
let arguments = (ins CIR_UIntOfWidths<[16, 32, 64]>:$input);
1805
1798
1806
1799
let assemblyFormat = [{
1807
- `(` $input `:` type($input) `)` `:` type($result) attr-dict
1800
+ $input `:` type($result) attr-dict
1808
1801
}];
1809
1802
}
1810
1803
0 commit comments