http://llvm.org/bugs/show_bug.cgi?id=21594

            Bug ID: 21594
           Summary: [AArch64][FastISel] Generates invalid shift immediate
                    greater than 31 (lsr w10, w8, #32)
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: ASSIGNED
          Severity: normal
          Priority: P
         Component: Backend: AArch64
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]
    Classification: Unclassified

When running with fast-isel the assembler is complaining about an invalid
immediate value on a shift instruction:

Error: immediate value out of range 0 to 31 at operand 3 -- `lsr w10,w10,#32'

Reduced test case:
--------------------------------------------------
$> more test.ll

; ModuleID = 'test.ll'
target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
target triple = "aarch64--linux-gnu"

%struct.element_t = type { i32 }

@list = internal constant [0 x %struct.element_t] zeroinitializer, align 4

define internal i32* @tink() {
entry:
  %call = call i32 bitcast (i32 (...)* @foo to i32 ()*)()
  %tobool = icmp ne i32 %call, 0
  br i1 %tobool, label %lor.lhs.false, label %if.then

lor.lhs.false:                                    ; preds = %entry
  %mul = mul nsw i32 1, undef
  %idx.ext = sext i32 %mul to i64
  %add.ptr = getelementptr inbounds i8* undef, i64 %idx.ext
  %call1 = call i32 bitcast (i32 (...)* @foo to i32 (i8*, i32)*)(i8* %add.ptr,
i32 undef)
  %tobool2 = icmp ne i32 %call1, 0
  br i1 %tobool2, label %lor.lhs.false3, label %if.then

lor.lhs.false3:                                   ; preds = %lor.lhs.false
  %mul4 = mul nsw i32 2, undef
  %idx.ext5 = sext i32 %mul4 to i64
  %add.ptr6 = getelementptr inbounds i8* undef, i64 %idx.ext5
  %call7 = call i32 bitcast (i32 (...)* @foo to i32 (i8*, i32)*)(i8* %add.ptr6,
i32 undef)
  %tobool8 = icmp ne i32 %call7, 0
  br i1 %tobool8, label %if.end, label %if.then

if.then:                                          ; preds = %lor.lhs.false3,
%lor.lhs.false, %entry
  br label %if.end

if.end:                                           ; preds = %if.then,
%lor.lhs.false3
  ret i32* undef
}

declare i32 @foo(...)
--------------------------------------------------

Reproduce with:
$> llc -O0 test.ll -o - | grep lsr
        lsr     w10, w8, #32

The regression looks to have been introduced around 08/27-08/28.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to