[llvm-bugs] [Bug 34919] New: vectorized code produces wrong result after r307036

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Oct 11 15:06:42 PDT 2017


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

            Bug ID: 34919
           Summary: vectorized code produces wrong result after r307036
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: GlobalISel
          Assignee: unassignedbugs at nondot.org
          Reporter: wmi at google.com
                CC: llvm-bugs at lists.llvm.org, zvi.rackover at intel.com

----------------------- 1.ll ------------------------------
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

declare i32 @printf(i8* nocapture readonly, ...) local_unnamed_addr
@.str = private unnamed_addr constant [4 x i8] c"%f\0A\00", align 1

define float @foo(<4 x i1> %t423, <4 x float> %t380) {
  %t424 = select <4 x i1> %t423, <4 x float> zeroinitializer, <4 x float> %t380
  %t427 = extractelement <4 x i1> %t423, i32 0
  %t429 = extractelement <4 x i1> %t423, i32 1
  %t431 = extractelement <4 x i1> %t423, i32 2
  %t438 = extractelement <4 x i1> %t423, i32 3

  %t428 = extractelement <4 x float> %t380, i32 0
  %t432 = extractelement <4 x float> %t380, i32 2

  %t433 = insertelement <2 x i1> undef, i1 %t427, i32 0
  %t434 = insertelement <2 x i1> %t433, i1 %t431, i32 1

  %t435 = insertelement <2 x float> undef, float %t428, i32 0
  %t436 = insertelement <2 x float> %t435, float %t432, i32 1

  %t437 = select <2 x i1> %t434, <2 x float> zeroinitializer, <2 x float> %t436
  %t454 = extractelement <4 x float> %t424, i32 2
  %t455 = extractelement <2 x float> %t437, i32 1
  %t456 = fsub float %t455, %t454
  ret float %t456
}

define void @main() {
  %ret = call float @foo(<4 x i1> <i1 1, i1 0, i1 1, i1 1>, <4 x float> <float
1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00>)
  %conv = fpext float %ret to double
  %call = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x
i8], [4 x i8]* @.str, i64 0, i64 0), double %conv)
  ret void
}
----------------------------------------------------------------------

~/workarea/llvm-r307035/dbuild/bin/llc -O0 -relocation-model=pic < 1.ll > 1.s
gcc 1.s -o a.out
./a.out
0.000000

~/workarea/llvm-r307036/dbuild/bin/llc -O0 -relocation-model=pic < 1.ll > 1.s
gcc 1.s -o a.out
./a.out
3.000000

-- 
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/20171011/23240cf4/attachment.html>


More information about the llvm-bugs mailing list