[llvm-bugs] [Bug 44135] New: Wrong promotion of vector to integer bitcast on big-endian targets

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Nov 25 06:53:24 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=44135

            Bug ID: 44135
           Summary: Wrong promotion of vector to integer bitcast on
                    big-endian targets
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: mikael.holmen at ericsson.com
                CC: llvm-bugs at lists.llvm.org

Reproducer:

;RUN: llc -O0 -mtriple=armebv7 -target-abi apcs -o - %s
-stop-before=finalize-isel | FileCheck %s

; Stop somewhere soon after isel.

@vec6_p = external global <6 x i16>

define i32 @foo() {
bb.0:
  %vec6 = load <6 x i16>, <6 x i16>* @vec6_p, align 1
  br label %bb.1

bb.1:
  %0 = bitcast <6 x i16> %vec6 to i96
  %1 = trunc i96 %0 to i32
  ret i32 %1
}

; CHECK-LABEL: bb.1.bb.1:
; CHECK:         [[REG0:%[0-9]+]]:qpr = VREV32q16 {{%[0-9]+}}
; CHECK:         [[REG1:%[0-9]+]]:dpr = COPY [[REG0]].dsub_1
; CHECK:         {{%[0-9]+}}:gpr = VGETLNi32 killed [[REG1]], 0


In the SelectionDAG printouts we see

Type-legalized selection DAG: %bb.1 'foo:bb.1'
SelectionDAG has 9 nodes:
  t0: ch = EntryToken
        t2: v8i16,ch = CopyFromReg t0, Register:v8i16 %0
      t17: v4i32 = bitcast t2
    t23: i32 = extract_vector_elt t17, Constant:i32<3>
  t8: ch,glue = CopyToReg t0, Register:i32 $r0, t23
  t9: ch = ARMISD::RET_FLAG t8, Register:i32 $r0, t8:1

and I think here the extract_vector_elt is wrong and extracts the value
from the wrong index.

The program program should return the 32 bits made up of the elements at
index 4 and 5 in the vec6 array, but with

    t23: i32 = extract_vector_elt t17, Constant:i32<3>

as far as I can tell, we will extract values that originally didn't even
exist in the vec6 vectore.

If we would instead extract the element at index 2 we would get the wanted
values.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191125/ba2e2b2f/attachment.html>


More information about the llvm-bugs mailing list