Skip to content

Commit 7003bed

Browse files
committed
Fix style and format
1 parent 7dce6c6 commit 7003bed

File tree

2 files changed

+40
-38
lines changed

2 files changed

+40
-38
lines changed

clang/lib/AST/ByteCode/InterpBuiltin.cpp

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4474,14 +4474,13 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
44744474
return interp__builtin_ia32_shuffle_generic(
44754475
S, OpPC, Call, [](unsigned DstIdx, unsigned ShuffleMask) {
44764476
uint8_t Ctlb = static_cast<uint8_t>(ShuffleMask);
4477-
if (Ctlb & 0x80) {
4477+
if (Ctlb & 0x80)
44784478
return std::make_pair(0, -1);
4479-
} else {
4480-
unsigned LaneBase = (DstIdx / 16) * 16;
4481-
unsigned SrcOffset = Ctlb & 0x0F;
4482-
unsigned SrcIdx = LaneBase + SrcOffset;
4483-
return std::make_pair(0, static_cast<int>(SrcIdx));
4484-
}
4479+
4480+
unsigned LaneBase = (DstIdx / 16) * 16;
4481+
unsigned SrcOffset = Ctlb & 0x0F;
4482+
unsigned SrcIdx = LaneBase + SrcOffset;
4483+
return std::make_pair(0, static_cast<int>(SrcIdx));
44854484
});
44864485

44874486
case X86::BI__builtin_ia32_pshuflw:
@@ -4494,25 +4493,25 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
44944493
if (LaneIdx < 4) {
44954494
unsigned Sel = (ShuffleMask >> (2 * LaneIdx)) & 0x3;
44964495
return std::make_pair(0, static_cast<int>(LaneBase + Sel));
4497-
} else {
4498-
return std::make_pair(0, static_cast<int>(DstIdx));
44994496
}
4497+
4498+
return std::make_pair(0, static_cast<int>(DstIdx));
45004499
});
45014500

45024501
case X86::BI__builtin_ia32_pshufhw:
45034502
case X86::BI__builtin_ia32_pshufhw256:
45044503
case X86::BI__builtin_ia32_pshufhw512:
45054504
return interp__builtin_ia32_shuffle_generic(
45064505
S, OpPC, Call, [](unsigned DstIdx, unsigned ShuffleMask) {
4507-
unsigned LaneBase = (DstIdx / 8) * 8;
4508-
unsigned LaneIdx = DstIdx % 8;
4509-
if (LaneIdx >= 4) {
4510-
unsigned Sel = (ShuffleMask >> (2 * (LaneIdx - 4))) & 0x3;
4511-
return std::make_pair(0, static_cast<int>(LaneBase + 4 + Sel));
4512-
} else {
4513-
return std::make_pair(0, static_cast<int>(DstIdx));
4514-
}
4515-
});
4506+
unsigned LaneBase = (DstIdx / 8) * 8;
4507+
unsigned LaneIdx = DstIdx % 8;
4508+
if (LaneIdx >= 4) {
4509+
unsigned Sel = (ShuffleMask >> (2 * (LaneIdx - 4))) & 0x3;
4510+
return std::make_pair(0, static_cast<int>(LaneBase + 4 + Sel));
4511+
}
4512+
4513+
return std::make_pair(0, static_cast<int>(DstIdx));
4514+
});
45164515

45174516
case X86::BI__builtin_ia32_pshufd:
45184517
case X86::BI__builtin_ia32_pshufd256:
@@ -4686,12 +4685,11 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
46864685
[](unsigned DstIdx, unsigned Shift) -> std::pair<unsigned, int> {
46874686
unsigned LaneBase = (DstIdx / 16) * 16;
46884687
unsigned LaneIdx = DstIdx % 16;
4689-
if (LaneIdx < Shift) {
4688+
if (LaneIdx < Shift)
46904689
return std::make_pair(0, -1);
4691-
}
4692-
4693-
return std::make_pair(0, static_cast<int>(LaneBase + LaneIdx - Shift));
46944690

4691+
return std::make_pair(0,
4692+
static_cast<int>(LaneBase + LaneIdx - Shift));
46954693
});
46964694

46974695
case X86::BI__builtin_ia32_psrldqi128_byteshift:
@@ -4706,9 +4704,9 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
47064704
[](unsigned DstIdx, unsigned Shift) -> std::pair<unsigned, int> {
47074705
unsigned LaneBase = (DstIdx / 16) * 16;
47084706
unsigned LaneIdx = DstIdx % 16;
4709-
if (LaneIdx + Shift < 16) {
4710-
return std::make_pair(0, static_cast<int>(LaneBase + LaneIdx + Shift));
4711-
}
4707+
if (LaneIdx + Shift < 16)
4708+
return std::make_pair(0,
4709+
static_cast<int>(LaneBase + LaneIdx + Shift));
47124710

47134711
return std::make_pair(0, -1);
47144712
});

clang/lib/AST/ExprConstant.cpp

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12929,7 +12929,8 @@ bool VectorExprEvaluator::VisitCallExpr(const CallExpr *E) {
1292912929
APValue R;
1293012930
if (!evalShuffleGeneric(
1293112931
Info, E, R,
12932-
[](unsigned DstIdx, unsigned ShuffleMask) -> std::pair<unsigned, int> {
12932+
[](unsigned DstIdx,
12933+
unsigned ShuffleMask) -> std::pair<unsigned, int> {
1293312934
uint8_t Ctlb = static_cast<uint8_t>(ShuffleMask);
1293412935
if (Ctlb & 0x80) {
1293512936
return std::make_pair(0, -1);
@@ -12961,7 +12962,7 @@ bool VectorExprEvaluator::VisitCallExpr(const CallExpr *E) {
1296112962
unsigned Sel = (Mask >> (2 * LaneIdx)) & 0x3;
1296212963
return std::make_pair(0, static_cast<int>(LaneBase + Sel));
1296312964
}
12964-
return std::make_pair(0, static_cast<int>(DstIdx));
12965+
return std::make_pair(0, static_cast<int>(DstIdx));
1296512966
}))
1296612967
return false;
1296712968
return Success(R, E);
@@ -12983,9 +12984,10 @@ bool VectorExprEvaluator::VisitCallExpr(const CallExpr *E) {
1298312984
if (LaneIdx >= HalfSize) {
1298412985
unsigned Rel = LaneIdx - HalfSize;
1298512986
unsigned Sel = (Mask >> (2 * Rel)) & 0x3;
12986-
return std::make_pair(0, static_cast<int>(LaneBase + HalfSize + Sel));
12987+
return std::make_pair(
12988+
0, static_cast<int>(LaneBase + HalfSize + Sel));
1298712989
}
12988-
return std::make_pair(0, static_cast<int>(DstIdx));
12990+
return std::make_pair(0, static_cast<int>(DstIdx));
1298912991
}))
1299012992
return false;
1299112993
return Success(R, E);
@@ -13491,14 +13493,15 @@ bool VectorExprEvaluator::VisitCallExpr(const CallExpr *E) {
1349113493
[](unsigned DstIdx, unsigned Shift) -> std::pair<unsigned, int> {
1349213494
unsigned LaneBase = (DstIdx / 16) * 16;
1349313495
unsigned LaneIdx = DstIdx % 16;
13494-
if (LaneIdx < Shift) {
13496+
if (LaneIdx < Shift)
1349513497
return std::make_pair(0, -1);
13496-
}
13497-
return std::make_pair(0, static_cast<int>(LaneBase + LaneIdx - Shift));
13498+
13499+
return std::make_pair(
13500+
0, static_cast<int>(LaneBase + LaneIdx - Shift));
1349813501
}))
1349913502
return false;
1350013503
return Success(R, E);
13501-
}
13504+
}
1350213505

1350313506
case X86::BI__builtin_ia32_psrldqi128_byteshift:
1350413507
case X86::BI__builtin_ia32_psrldqi256_byteshift:
@@ -13509,14 +13512,15 @@ bool VectorExprEvaluator::VisitCallExpr(const CallExpr *E) {
1350913512
[](unsigned DstIdx, unsigned Shift) -> std::pair<unsigned, int> {
1351013513
unsigned LaneBase = (DstIdx / 16) * 16;
1351113514
unsigned LaneIdx = DstIdx % 16;
13512-
if (LaneIdx + Shift < 16) {
13513-
return std::make_pair(0, static_cast<int>(LaneBase + LaneIdx + Shift));
13514-
}
13515-
return std::make_pair(0, -1);
13515+
if (LaneIdx + Shift < 16)
13516+
return std::make_pair(
13517+
0, static_cast<int>(LaneBase + LaneIdx + Shift));
13518+
13519+
return std::make_pair(0, -1);
1351613520
}))
1351713521
return false;
1351813522
return Success(R, E);
13519-
}
13523+
}
1352013524
case X86::BI__builtin_ia32_vpermi2varq128:
1352113525
case X86::BI__builtin_ia32_vpermi2varpd128: {
1352213526
APValue R;

0 commit comments

Comments
 (0)