File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,14 @@ bool IsX86_MMXType(llvm::Type *IRType) {
2727static llvm::Type *X86AdjustInlineAsmType (CodeGen::CodeGenFunction &CGF,
2828 StringRef Constraint,
2929 llvm::Type *Ty) {
30+ bool IsMMXCons = llvm::StringSwitch<bool >(Constraint)
31+ .Cases ({" y" , " &y" , " ^Ym" }, true )
32+ .Default (false );
33+ if (IsMMXCons && Ty->isVectorTy () &&
34+ cast<llvm::VectorType>(Ty)->getPrimitiveSizeInBits ().getFixedValue () !=
35+ 64 )
36+ return nullptr ; // Invalid MMX constraint
37+
3038 if (Constraint == " k" ) {
3139 llvm::Type *Int1Ty = llvm::Type::getInt1Ty (CGF.getLLVMContext ());
3240 return llvm::FixedVectorType::get (Int1Ty, Ty->getScalarSizeInBits ());
Original file line number Diff line number Diff line change 11// RUN: %clang_cc1 -verify -triple x86_64-unknown-unknown -emit-llvm-only %s
2+ // RUN: %clang_cc1 -verify=omp -triple x86_64-unknown-unknown -emit-llvm-only -fopenmp %s
23typedef int vec256 __attribute__((ext_vector_type (8 )));
34
45vec256 foo (vec256 in ) {
56 vec256 out ;
67
78 asm("something %0" : : "y" (in )); // expected-error {{invalid input size for constraint 'y'}}
9+ // omp-error@+1 {{invalid type 'vec256' (vector of 8 'int' values) in asm input for constraint 'y'}}
810 asm("something %0" : "=y" (out )); // expected-error {{invalid output size for constraint '=y'}}
11+ // omp-error@+1 {{invalid type 'vec256' (vector of 8 'int' values) in asm input for constraint 'y'}}
912 asm("something %0, %0" : "+y" (out )); // expected-error {{invalid output size for constraint '+y'}}
1013
1114 return out ;
1215}
13-
You can’t perform that action at this time.
0 commit comments