[LLVMbugs] [Bug 15009] New: Clang coerces char __attribute__((ext_vector_type(4))) to int32.
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sun Jan 20 13:17:34 PST 2013
http://llvm.org/bugs/show_bug.cgi?id=15009
Bug #: 15009
Summary: Clang coerces char __attribute__((ext_vector_type(4)))
to int32.
Product: clang
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: mgottesman at apple.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Clang compiles the following c code:
-----
typedef char char4 __attribute__((ext_vector_type(4)));
char4 sub(char4 x, char4 y) {
return x + y;
}
-----
to the following using 'clang -c test.c -emit-llvm -S -o test.ll':
-----
; ModuleID = 'test.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-apple-macosx10.8.0"
define i32 @sub(i32 %x.coerce, i32 %y.coerce) nounwind uwtable ssp {
entry:
%retval = alloca <4 x i8>, align 4
%x = alloca <4 x i8>, align 4
%x.addr = alloca <4 x i8>, align 4
%y = alloca <4 x i8>, align 4
%y.addr = alloca <4 x i8>, align 4
%0 = bitcast <4 x i8>* %x to i32*
store i32 %x.coerce, i32* %0, align 1
%x1 = load <4 x i8>* %x, align 4
store <4 x i8> %x1, <4 x i8>* %x.addr, align 4
%1 = bitcast <4 x i8>* %y to i32*
store i32 %y.coerce, i32* %1, align 1
%y2 = load <4 x i8>* %y, align 4
store <4 x i8> %y2, <4 x i8>* %y.addr, align 4
%2 = load <4 x i8>* %x.addr, align 4
%3 = load <4 x i8>* %y.addr, align 4
%add = add <4 x i8> %2, %3
store <4 x i8> %add, <4 x i8>* %retval
%4 = bitcast <4 x i8>* %retval to i32*
%5 = load i32* %4, align 1
ret i32 %5
}
-----
Is this correct? IMHO clang should not be doing such coercions, no?
--
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