diff options
| author | Chris Lattner <sabre@nondot.org> | 2005-12-21 18:31:29 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2005-12-21 18:31:29 +0000 |
| commit | a5d70e9feb81c0bcfa852acca69603a5593c803d (patch) | |
| tree | 56a9e0844763f1a23e27c8cf4553a8f0d4b53260 /llvm/lib/AsmParser | |
| parent | dca56cbd9a257e89c4981a54aa8c54287002850b (diff) | |
| download | bcm5719-llvm-a5d70e9feb81c0bcfa852acca69603a5593c803d.tar.gz bcm5719-llvm-a5d70e9feb81c0bcfa852acca69603a5593c803d.zip | |
allow logical operators on packed integral types
llvm-svn: 24907
Diffstat (limited to 'llvm/lib/AsmParser')
| -rw-r--r-- | llvm/lib/AsmParser/llvmAsmParser.y | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/AsmParser/llvmAsmParser.y b/llvm/lib/AsmParser/llvmAsmParser.y index dfaeb830152..b5a3dcd46cd 100644 --- a/llvm/lib/AsmParser/llvmAsmParser.y +++ b/llvm/lib/AsmParser/llvmAsmParser.y @@ -1501,8 +1501,11 @@ ConstExpr: CAST '(' ConstVal TO Types ')' { | LogicalOps '(' ConstVal ',' ConstVal ')' { if ($3->getType() != $5->getType()) ThrowException("Logical operator types must match!"); - if (!$3->getType()->isIntegral()) - ThrowException("Logical operands must have integral types!"); + if (!$3->getType()->isIntegral()) { + if (!isa<PackedType>($3->getType()) || + !cast<PackedType>($3->getType())->getElementType()->isIntegral()) + ThrowException("Logical operator requires integral operands!"); + } $$ = ConstantExpr::get($1, $3, $5); } | SetCondOps '(' ConstVal ',' ConstVal ')' { @@ -2079,8 +2082,11 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef { delete $2; } | LogicalOps Types ValueRef ',' ValueRef { - if (!(*$2)->isIntegral()) - ThrowException("Logical operator requires integral operands!"); + if (!(*$2)->isIntegral()) { + if (!isa<PackedType>($2->get()) || + !cast<PackedType>($2->get())->getElementType()->isIntegral()) + ThrowException("Logical operator requires integral operands!"); + } $$ = BinaryOperator::create($1, getVal(*$2, $3), getVal(*$2, $5)); if ($$ == 0) ThrowException("binary operator returned null!"); |

