Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assertion failure handling 64-bit umulh sequence #1570

Closed
sunfishcode opened this issue Feb 13, 2007 · 1 comment
Closed

assertion failure handling 64-bit umulh sequence #1570

sunfishcode opened this issue Feb 13, 2007 · 1 comment
Labels
bugzilla Issues migrated from bugzilla compile-fail Use [accepts-invalid] and [rejects-valid] instead llvm:codegen

Comments

@sunfishcode
Copy link
Member

Bugzilla Link 1198
Resolution FIXED
Resolved on Feb 22, 2010 12:53
Version trunk
OS All

Extended Description

This test case:

define i64 @​foo(i64 %x, i64 %y) {
%tmp0 = zext i64 %x to i128
%tmp1 = zext i64 %y to i128
%tmp2 = mul i128 %tmp0, %tmp1
%tmp7 = zext i32 64 to i128
%tmp3 = lshr i128 %tmp2, %tmp7
%tmp4 = trunc i128 %tmp3 to i64
ret i64 %tmp4
}

compiled with -march=x86-64 triggers the following assertion failure:

lib/CodeGen/SelectionDAG/TargetLowering.cpp:2197: llvm::MVT::ValueType
llvm::TargetLowering::getValueType(const llvm::Type*) const: Assertion `0 &&
"Invalid width for value type"' failed.

The following patch fixes it.

Index: TargetLowering.cpp

RCS file: /var/cvs/llvm/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp,v
retrieving revision 1.89
diff -u -r1.89 TargetLowering.cpp
--- TargetLowering.cpp
+++ TargetLowering.cpp
@@ -2200,6 +2200,7 @@
case 16: return MVT::i16;
case 32: return MVT::i32;
case 64: return MVT::i64;

  •  case 128:  return MVT::i128;
    
    }
    break;
    case Type::FloatTyID: return MVT::f32;
@lattner
Copy link
Collaborator

lattner commented Feb 14, 2007

Very nice catch. I applied your patch:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070212/044465.html

and checked in your testcase here: test/CodeGen/X86/i128-mul.ll

Note that 128-bit integer support in the LLVM level is desired, but not really ready yet. Things like 128-
bit immediates are not handled right. Fortunately, the APInt stuff is great steps in the right direction, so
we should have it for LLVM 2.0.

-Chris

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla compile-fail Use [accepts-invalid] and [rejects-valid] instead llvm:codegen
Projects
None yet
Development

No branches or pull requests

2 participants