@@ -1578,7 +1578,7 @@ auto Codegen::ExpressionVisitor::operator()(BinaryExpressionAST* ast)
15781578 }
15791579
15801580 case TokenKind::T_LESS_LESS: {
1581- if (control ()->is_integral (ast->type )) {
1581+ if (control ()->is_integral_or_unscoped_enum (ast->type )) {
15821582 auto op = mlir::cxx::ShiftLeftOp::create (gen.builder_ , loc, resultType,
15831583 leftExpressionResult.value ,
15841584 rightExpressionResult.value );
@@ -1589,7 +1589,7 @@ auto Codegen::ExpressionVisitor::operator()(BinaryExpressionAST* ast)
15891589 }
15901590
15911591 case TokenKind::T_GREATER_GREATER: {
1592- if (control ()->is_integral (ast->type )) {
1592+ if (control ()->is_integral_or_unscoped_enum (ast->type )) {
15931593 auto op = mlir::cxx::ShiftRightOp::create (gen.builder_ , loc, resultType,
15941594 leftExpressionResult.value ,
15951595 rightExpressionResult.value );
@@ -1600,7 +1600,7 @@ auto Codegen::ExpressionVisitor::operator()(BinaryExpressionAST* ast)
16001600 }
16011601
16021602 case TokenKind::T_EQUAL_EQUAL: {
1603- if (control ()->is_integral (ast->type )) {
1603+ if (control ()->is_integral_or_unscoped_enum (ast->type )) {
16041604 auto op = mlir::cxx::EqualOp::create (gen.builder_ , loc, resultType,
16051605 leftExpressionResult.value ,
16061606 rightExpressionResult.value );
@@ -1618,14 +1618,14 @@ auto Codegen::ExpressionVisitor::operator()(BinaryExpressionAST* ast)
16181618 }
16191619
16201620 case TokenKind::T_EXCLAIM_EQUAL: {
1621- if (control ()->is_integral (ast->type )) {
1621+ if (control ()->is_integral_or_unscoped_enum (ast-> leftExpression ->type )) {
16221622 auto op = mlir::cxx::NotEqualOp::create (gen.builder_ , loc, resultType,
16231623 leftExpressionResult.value ,
16241624 rightExpressionResult.value );
16251625 return {op};
16261626 }
16271627
1628- if (control ()->is_floating_point (ast->type )) {
1628+ if (control ()->is_floating_point (ast->leftExpression -> type )) {
16291629 auto op = mlir::cxx::NotEqualFOp::create (gen.builder_ , loc, resultType,
16301630 leftExpressionResult.value ,
16311631 rightExpressionResult.value );
@@ -1636,14 +1636,14 @@ auto Codegen::ExpressionVisitor::operator()(BinaryExpressionAST* ast)
16361636 }
16371637
16381638 case TokenKind::T_LESS: {
1639- if (control ()->is_integral (ast->type )) {
1639+ if (control ()->is_integral_or_unscoped_enum (ast-> leftExpression ->type )) {
16401640 auto op = mlir::cxx::LessThanOp::create (gen.builder_ , loc, resultType,
16411641 leftExpressionResult.value ,
16421642 rightExpressionResult.value );
16431643 return {op};
16441644 }
16451645
1646- if (control ()->is_floating_point (ast->type )) {
1646+ if (control ()->is_floating_point (ast->leftExpression -> type )) {
16471647 auto op = mlir::cxx::LessThanFOp::create (gen.builder_ , loc, resultType,
16481648 leftExpressionResult.value ,
16491649 rightExpressionResult.value );
@@ -1654,14 +1654,14 @@ auto Codegen::ExpressionVisitor::operator()(BinaryExpressionAST* ast)
16541654 }
16551655
16561656 case TokenKind::T_LESS_EQUAL: {
1657- if (control ()->is_integral (ast->type )) {
1657+ if (control ()->is_integral_or_unscoped_enum (ast-> leftExpression ->type )) {
16581658 auto op = mlir::cxx::LessEqualOp::create (gen.builder_ , loc, resultType,
16591659 leftExpressionResult.value ,
16601660 rightExpressionResult.value );
16611661 return {op};
16621662 }
16631663
1664- if (control ()->is_floating_point (ast->type )) {
1664+ if (control ()->is_floating_point (ast->leftExpression -> type )) {
16651665 auto op = mlir::cxx::LessEqualFOp::create (gen.builder_ , loc, resultType,
16661666 leftExpressionResult.value ,
16671667 rightExpressionResult.value );
@@ -1672,14 +1672,14 @@ auto Codegen::ExpressionVisitor::operator()(BinaryExpressionAST* ast)
16721672 }
16731673
16741674 case TokenKind::T_GREATER: {
1675- if (control ()->is_integral (ast->type )) {
1675+ if (control ()->is_integral_or_unscoped_enum (ast-> leftExpression ->type )) {
16761676 auto op = mlir::cxx::GreaterThanOp::create (
16771677 gen.builder_ , loc, resultType, leftExpressionResult.value ,
16781678 rightExpressionResult.value );
16791679 return {op};
16801680 }
16811681
1682- if (control ()->is_floating_point (ast->type )) {
1682+ if (control ()->is_floating_point (ast->leftExpression -> type )) {
16831683 auto op = mlir::cxx::GreaterThanFOp::create (
16841684 gen.builder_ , loc, resultType, leftExpressionResult.value ,
16851685 rightExpressionResult.value );
@@ -1690,14 +1690,14 @@ auto Codegen::ExpressionVisitor::operator()(BinaryExpressionAST* ast)
16901690 }
16911691
16921692 case TokenKind::T_GREATER_EQUAL: {
1693- if (control ()->is_integral (ast->type )) {
1693+ if (control ()->is_integral_or_unscoped_enum (ast-> leftExpression ->type )) {
16941694 auto op = mlir::cxx::GreaterEqualOp::create (
16951695 gen.builder_ , loc, resultType, leftExpressionResult.value ,
16961696 rightExpressionResult.value );
16971697 return {op};
16981698 }
16991699
1700- if (control ()->is_floating_point (ast->type )) {
1700+ if (control ()->is_floating_point (ast->leftExpression -> type )) {
17011701 auto op = mlir::cxx::GreaterEqualFOp::create (
17021702 gen.builder_ , loc, resultType, leftExpressionResult.value ,
17031703 rightExpressionResult.value );
@@ -1707,6 +1707,27 @@ auto Codegen::ExpressionVisitor::operator()(BinaryExpressionAST* ast)
17071707 break ;
17081708 }
17091709
1710+ case TokenKind::T_CARET: {
1711+ auto op = mlir::cxx::XorOp::create (gen.builder_ , loc, resultType,
1712+ leftExpressionResult.value ,
1713+ rightExpressionResult.value );
1714+ return {op};
1715+ }
1716+
1717+ case TokenKind::T_AMP: {
1718+ auto op = mlir::cxx::AndOp::create (gen.builder_ , loc, resultType,
1719+ leftExpressionResult.value ,
1720+ rightExpressionResult.value );
1721+ return {op};
1722+ }
1723+
1724+ case TokenKind::T_BAR: {
1725+ auto op = mlir::cxx::OrOp::create (gen.builder_ , loc, resultType,
1726+ leftExpressionResult.value ,
1727+ rightExpressionResult.value );
1728+ return {op};
1729+ }
1730+
17101731 default :
17111732 break ;
17121733 } // switch
0 commit comments