Skip to content

Commit 7b368e3

Browse files
committed
make clang format happy
1 parent 12cac48 commit 7b368e3

File tree

2 files changed

+31
-47
lines changed

2 files changed

+31
-47
lines changed

clang/lib/Headers/hlsl/hlsl_intrinsics.h

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -738,31 +738,15 @@ constexpr uint4 countbits(uint16_t4 x) {
738738
}
739739
#endif
740740

741-
constexpr uint countbits(int x) {
742-
return __builtin_elementwise_popcount(x);
743-
}
744-
constexpr uint2 countbits(int2 x) {
745-
return __builtin_elementwise_popcount(x);
746-
}
747-
constexpr uint3 countbits(int3 x) {
748-
return __builtin_elementwise_popcount(x);
749-
}
750-
constexpr uint4 countbits(int4 x) {
751-
return __builtin_elementwise_popcount(x);
752-
}
753-
754-
constexpr uint countbits(uint x) {
755-
return __builtin_elementwise_popcount(x);
756-
}
757-
constexpr uint2 countbits(uint2 x) {
758-
return __builtin_elementwise_popcount(x);
759-
}
760-
constexpr uint3 countbits(uint3 x) {
761-
return __builtin_elementwise_popcount(x);
762-
}
763-
constexpr uint4 countbits(uint4 x) {
764-
return __builtin_elementwise_popcount(x);
765-
}
741+
constexpr uint countbits(int x) { return __builtin_elementwise_popcount(x); }
742+
constexpr uint2 countbits(int2 x) { return __builtin_elementwise_popcount(x); }
743+
constexpr uint3 countbits(int3 x) { return __builtin_elementwise_popcount(x); }
744+
constexpr uint4 countbits(int4 x) { return __builtin_elementwise_popcount(x); }
745+
746+
constexpr uint countbits(uint x) { return __builtin_elementwise_popcount(x); }
747+
constexpr uint2 countbits(uint2 x) { return __builtin_elementwise_popcount(x); }
748+
constexpr uint3 countbits(uint3 x) { return __builtin_elementwise_popcount(x); }
749+
constexpr uint4 countbits(uint4 x) { return __builtin_elementwise_popcount(x); }
766750

767751
constexpr uint countbits(int64_t x) {
768752
return __builtin_elementwise_popcount(x);

llvm/lib/Target/DirectX/DXILOpLowering.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ class OpLowerer {
463463
[[nodiscard]] bool lowerCtpopToCBits(Function &F) {
464464
IRBuilder<> &IRB = OpBuilder.getIRB();
465465
Type *Int32Ty = IRB.getInt32Ty();
466-
466+
467467
return replaceFunction(F, [&](CallInst *CI) -> Error {
468468
IRB.SetInsertPoint(CI);
469469
SmallVector<Value *> Args;
@@ -473,48 +473,48 @@ class OpLowerer {
473473
Type *FRT = F.getReturnType();
474474
if (FRT->isVectorTy()) {
475475
VectorType *VT = cast<VectorType>(FRT);
476-
RetTy = VectorType::get(RetTy, VT);
476+
RetTy = VectorType::get(RetTy, VT);
477477
}
478-
479-
Expected<CallInst *> OpCall =
480-
OpBuilder.tryCreateOp(dxil::OpCode::CBits, Args, CI->getName(), RetTy);
478+
479+
Expected<CallInst *> OpCall = OpBuilder.tryCreateOp(
480+
dxil::OpCode::CBits, Args, CI->getName(), RetTy);
481481
if (Error E = OpCall.takeError())
482-
return E;
482+
return E;
483483

484484
// If the result type is 32 bits we can do a direct replacement.
485485
if (FRT->isIntOrIntVectorTy(32)) {
486486
CI->replaceAllUsesWith(*OpCall);
487-
CI->eraseFromParent();
488-
return Error::success();
487+
CI->eraseFromParent();
488+
return Error::success();
489489
}
490490

491491
unsigned CastOp;
492492
if (FRT->isIntOrIntVectorTy(16))
493-
CastOp = Instruction::ZExt;
493+
CastOp = Instruction::ZExt;
494494
else // must be 64 bits
495-
CastOp = Instruction::Trunc;
495+
CastOp = Instruction::Trunc;
496496

497497
// It is correct to replace the ctpop with the dxil op and
498498
// remove an existing cast iff the cast is the only usage of
499499
// the ctpop
500500
// can use hasOneUse instead of hasOneUser, because the user
501501
// we care about should have one operand
502502
if (CI->hasOneUse()) {
503-
User *U = CI->user_back();
504-
Instruction *I;
505-
if (isa<Instruction>(U) && (I = cast<Instruction>(U)) &&
506-
I->getOpcode() == CastOp && I->getType() == RetTy) {
503+
User *U = CI->user_back();
504+
Instruction *I;
505+
if (isa<Instruction>(U) && (I = cast<Instruction>(U)) &&
506+
I->getOpcode() == CastOp && I->getType() == RetTy) {
507507
I->replaceAllUsesWith(*OpCall);
508-
I->eraseFromParent();
509-
CI->eraseFromParent();
510-
return Error::success();
511-
}
508+
I->eraseFromParent();
509+
CI->eraseFromParent();
510+
return Error::success();
511+
}
512512
}
513513

514514
// It is always correct to replace a ctpop with the dxil op and
515515
// a cast
516-
Value *Cast = IRB.CreateZExtOrTrunc(*OpCall, F.getReturnType(),
517-
"ctpop.cast");
516+
Value *Cast =
517+
IRB.CreateZExtOrTrunc(*OpCall, F.getReturnType(), "ctpop.cast");
518518
CI->replaceAllUsesWith(Cast);
519519
CI->eraseFromParent();
520520
return Error::success();
@@ -550,8 +550,8 @@ class OpLowerer {
550550
HasErrors |= lowerTypedBufferStore(F);
551551
break;
552552
case Intrinsic::ctpop:
553-
HasErrors |= lowerCtpopToCBits(F);
554-
break;
553+
HasErrors |= lowerCtpopToCBits(F);
554+
break;
555555
}
556556
Updated = true;
557557
}

0 commit comments

Comments
 (0)