RKSimon created this revision. I can add the other test cases from PR34021 if required?
Repository: rL LLVM https://reviews.llvm.org/D37448 Files: lib/CodeGen/CGStmt.cpp test/CodeGen/pr34021.c Index: test/CodeGen/pr34021.c =================================================================== --- test/CodeGen/pr34021.c +++ test/CodeGen/pr34021.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -fms-extensions %s -triple=i686-unknown-unknown -emit-llvm -o - +// RUN: %clang_cc1 -fms-extensions %s -triple=x86_64-unknown-unknown -emit-llvm -o - +// REQUIRES: asserts + +typedef int v4si __attribute__ ((vector_size (16))); +v4si rep() { + v4si res; + __asm {} + return res; +} Index: lib/CodeGen/CGStmt.cpp =================================================================== --- lib/CodeGen/CGStmt.cpp +++ lib/CodeGen/CGStmt.cpp @@ -2210,7 +2210,7 @@ llvm::IntegerType::get(getLLVMContext(), (unsigned)TmpSize)); Tmp = Builder.CreateTrunc(Tmp, TruncTy); } else if (TruncTy->isIntegerTy()) { - Tmp = Builder.CreateTrunc(Tmp, TruncTy); + Tmp = Builder.CreateZExtOrTrunc(Tmp, TruncTy); } else if (TruncTy->isVectorTy()) { Tmp = Builder.CreateBitCast(Tmp, TruncTy); }
Index: test/CodeGen/pr34021.c =================================================================== --- test/CodeGen/pr34021.c +++ test/CodeGen/pr34021.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -fms-extensions %s -triple=i686-unknown-unknown -emit-llvm -o - +// RUN: %clang_cc1 -fms-extensions %s -triple=x86_64-unknown-unknown -emit-llvm -o - +// REQUIRES: asserts + +typedef int v4si __attribute__ ((vector_size (16))); +v4si rep() { + v4si res; + __asm {} + return res; +} Index: lib/CodeGen/CGStmt.cpp =================================================================== --- lib/CodeGen/CGStmt.cpp +++ lib/CodeGen/CGStmt.cpp @@ -2210,7 +2210,7 @@ llvm::IntegerType::get(getLLVMContext(), (unsigned)TmpSize)); Tmp = Builder.CreateTrunc(Tmp, TruncTy); } else if (TruncTy->isIntegerTy()) { - Tmp = Builder.CreateTrunc(Tmp, TruncTy); + Tmp = Builder.CreateZExtOrTrunc(Tmp, TruncTy); } else if (TruncTy->isVectorTy()) { Tmp = Builder.CreateBitCast(Tmp, TruncTy); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits