[LLVMbugs] [Bug 11439] Operations on double3 mis-optimised to double2

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Nov 28 15:22:11 PST 2011


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

Tanya Lattner <tonic at nondot.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #2 from Tanya Lattner <tonic at nondot.org> 2011-11-28 17:22:11 CST ---
This is a code generation issue in clang for x86_64. I believe it should be
fixed in r145312.

Basically, for double3 it was trying to coerce it a double2 which is obviously
incorrect.

Previous LLVM IR output from clang:
define <2 x double> @add(<2 x double> %x.coerce) nounwind {
entry:
  %retval = alloca <3 x double>, align 32
  %coerce = alloca <3 x double>, align 32
  %x.addr = alloca <3 x double>, align 32
  %0 = bitcast <3 x double>* %coerce to <2 x double>*
  store <2 x double> %x.coerce, <2 x double>* %0
  %x = load <3 x double>* %coerce, align 32
  store <3 x double> %x, <3 x double>* %x.addr, align 32
  %1 = load <3 x double>* %x.addr, align 32
  %add = fadd <3 x double> %1, <double 1.000000e+00, double 1.000000e+00,
double 1.000000e+00>
  store <3 x double> %add, <3 x double>* %retval
  %2 = bitcast <3 x double>* %retval to <2 x double>*
  %3 = load <2 x double>* %2, align 1
  ret <2 x double> %3
}

With my fix:
; ModuleID = 'x.c'
target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-unknown"

define <3 x double> @add(<3 x double> %x) nounwind {
entry:
  %x.addr = alloca <3 x double>, align 32
  store <3 x double> %x, <3 x double>* %x.addr, align 32
  %0 = load <3 x double>* %x.addr, align 32
  %add = fadd <3 x double> %0, <double 1.000000e+00, double 1.000000e+00,
double 1.000000e+00>
  ret <3 x double> %add
}

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list