Open gottesmm opened 11 years ago
Clang compiles the following c file:
typedef int int2 attribute((ext_vector_type(2))); typedef unsigned uint2 attribute((ext_vector_type(2)));
int2 test(int2 x, int2 y) { return x + y; }
to the following IR using 'clang -c test.c -emit-llvm -S -o -':
; 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 double @test(double %x.coerce, double %y.coerce) nounwind uwtable ssp { entry: %retval = alloca <2 x i32>, align 8 %x = alloca <2 x i32>, align 8 %x.addr = alloca <2 x i32>, align 8 %y = alloca <2 x i32>, align 8 %y.addr = alloca <2 x i32>, align 8 %0 = bitcast <2 x i32> %x to double store double %x.coerce, double %0, align 1 %x1 = load <2 x i32> %x, align 8 store <2 x i32> %x1, <2 x i32> %x.addr, align 8 %1 = bitcast <2 x i32> %y to double store double %y.coerce, double %1, align 1 %y2 = load <2 x i32> %y, align 8 store <2 x i32> %y2, <2 x i32> %y.addr, align 8 %2 = load <2 x i32> %x.addr, align 8 %3 = load <2 x i32> %y.addr, align 8 %add = add <2 x i32> %2, %3 store <2 x i32> %add, <2 x i32> %retval %4 = bitcast <2 x i32> %retval to double %5 = load double %4, align 1 ret double %5 }
mentioned in issue llvm/llvm-bugzilla-archive#15011
The same seems to happen with float2:
typedef float float2 attribute((ext_vector_type(2)));
Extended Description
Clang compiles the following c file:
typedef int int2 attribute((ext_vector_type(2))); typedef unsigned uint2 attribute((ext_vector_type(2)));
int2 test(int2 x, int2 y) { return x + y; }
uint2 test2(uint2 x, uint2 y) { return x + y; }
to the following IR using 'clang -c test.c -emit-llvm -S -o -':
; 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 double @test(double %x.coerce, double %y.coerce) nounwind uwtable ssp { entry: %retval = alloca <2 x i32>, align 8 %x = alloca <2 x i32>, align 8 %x.addr = alloca <2 x i32>, align 8 %y = alloca <2 x i32>, align 8 %y.addr = alloca <2 x i32>, align 8 %0 = bitcast <2 x i32> %x to double store double %x.coerce, double %0, align 1 %x1 = load <2 x i32> %x, align 8 store <2 x i32> %x1, <2 x i32> %x.addr, align 8 %1 = bitcast <2 x i32> %y to double store double %y.coerce, double %1, align 1 %y2 = load <2 x i32> %y, align 8 store <2 x i32> %y2, <2 x i32> %y.addr, align 8 %2 = load <2 x i32> %x.addr, align 8 %3 = load <2 x i32> %y.addr, align 8 %add = add <2 x i32> %2, %3 store <2 x i32> %add, <2 x i32> %retval %4 = bitcast <2 x i32> %retval to double %5 = load double %4, align 1 ret double %5 }
define double @test2(double %x.coerce, double %y.coerce) nounwind uwtable ssp { entry: %retval = alloca <2 x i32>, align 8 %x = alloca <2 x i32>, align 8 %x.addr = alloca <2 x i32>, align 8 %y = alloca <2 x i32>, align 8 %y.addr = alloca <2 x i32>, align 8 %0 = bitcast <2 x i32> %x to double store double %x.coerce, double %0, align 1 %x1 = load <2 x i32> %x, align 8 store <2 x i32> %x1, <2 x i32> %x.addr, align 8 %1 = bitcast <2 x i32> %y to double store double %y.coerce, double %1, align 1 %y2 = load <2 x i32> %y, align 8 store <2 x i32> %y2, <2 x i32> %y.addr, align 8 %2 = load <2 x i32> %x.addr, align 8 %3 = load <2 x i32> %y.addr, align 8 %add = add <2 x i32> %2, %3 store <2 x i32> %add, <2 x i32> %retval %4 = bitcast <2 x i32> %retval to double %5 = load double %4, align 1 ret double %5 }