yaxunl added inline comments.

================
Comment at: lib/CodeGen/CGExprScalar.cpp:3394
@@ +3393,3 @@
+  if (NumElementsDst == 4)
+    Args.push_back(llvm::UndefValue::get(CGF.Int32Ty));
+  llvm::Constant *Mask = llvm::ConstantVector::get(Args);
----------------
Anastasia wrote:
> should this be 3 unstead of undef?
3 or undef are both OK here since the 4th component is undefined. undef may be 
better since if optimizer checks mask first, it knows that the 4th component is 
undefined without further checking the second operand.

================
Comment at: test/CodeGenOpenCL/as_type.cl:8
@@ +7,3 @@
+
+//CHECK: define spir_func <3 x i8> @f1(<4 x i8> %[[x:.*]])
+//CHECK: %[[astype:.*]] = shufflevector <4 x i8> %[[x]], <4 x i8> undef, <3 x 
i32> <i32 0, i32 1, i32 2>
----------------
Anastasia wrote:
> So what happens if the number of bytes don't match?
There will be compilation error and diag msg. I will add a sema test.

================
Comment at: test/CodeGenOpenCL/as_type.cl:46
@@ +45,3 @@
+//CHECK: define spir_func i32 @f6(<4 x i8> %[[x:.*]])
+//CHECK: %[[astype]] = bitcast <4 x i8> %[[x]] to i32
+//CHECK: ret i32 %[[astype]]
----------------
Anastasia wrote:
> Would it make sense to check that shufflevector is not generated?
will fix

================
Comment at: test/CodeGenOpenCL/as_type.cl:53
@@ +52,3 @@
+//CHECK: define spir_func <3 x i8> @f7(<3 x i8> %[[x:.*]])
+//CHECK: ret <3 x i8> %[[x]]
+char3 f7(char3 x) {
----------------
Anastasia wrote:
> Could we add CHECK-NOT bitcast here?
will fix


http://reviews.llvm.org/D20133



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to