Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions clang/lib/CodeGen/CGExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2085,10 +2085,15 @@ RValue CodeGenFunction::EmitLoadOfLValue(LValue LV, SourceLocation Loc) {
}

if (LV.isVectorElt()) {
llvm::LoadInst *Load = Builder.CreateLoad(LV.getVectorAddress(),
LV.isVolatileQualified());
return RValue::get(Builder.CreateExtractElement(Load, LV.getVectorIdx(),
"vecext"));
llvm::Value *Load = nullptr;
if (LV.getType()->isExtVectorBoolType())
Load = EmitLoadOfScalar(LV.getVectorAddress(), LV.isVolatileQualified(),
LV.getType(), Loc);
else
Load =
Builder.CreateLoad(LV.getVectorAddress(), LV.isVolatileQualified());
return RValue::get(
Builder.CreateExtractElement(Load, LV.getVectorIdx(), "vecext"));
}

// If this is a reference to a subset of the elements of a vector, either
Expand Down
9 changes: 9 additions & 0 deletions clang/test/CodeGen/gh72468.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// RUN: %clang_cc1 -S -emit-llvm -o - %s

typedef __attribute__((__ext_vector_type__(4))) _Bool BoolVector;

BoolVector vec;

void f(int i, int j) {
vec[i] |= vec[j];
}
8 changes: 4 additions & 4 deletions clang/test/SemaCXX/vector-bool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ void Operations() {
// (void)(eight_bools > other_eight_bools);
// (void)(eight_bools >= other_eight_bools);

// // Legal assignments
// (void)(eight_bools |= other_eight_bools);
// (void)(eight_bools &= other_eight_bools);
// (void)(eight_bools ^= other_eight_bools);
// Legal assignments
(void)(eight_bools |= other_eight_bools);
(void)(eight_bools &= other_eight_bools);
(void)(eight_bools ^= other_eight_bools);

// Illegal operators
(void)(eight_bools || other_eight_bools); // expected-error@47 {{invalid operands to binary expression ('EightBools' (vector of 8 'bool' values) and 'EightBools')}}
Expand Down