Skip to content

Commit 5417390

Browse files
committed
clang format
1 parent 7757531 commit 5417390

File tree

3 files changed

+39
-21
lines changed

3 files changed

+39
-21
lines changed

clang/include/clang/Basic/BuiltinsX86.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,12 +697,12 @@ let Features = "avx2", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
697697
def gatherq_d : X86Builtin<"_Vector<4, int>(_Vector<4, int>, int const *, _Vector<2, long long int>, _Vector<4, int>, _Constant char)">;
698698
}
699699

700-
let Features = "f16c",
700+
let Features = "f16c",
701701
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
702702
def vcvtps2ph : X86Builtin<"_Vector<8, short>(_Vector<4, float>, _Constant int)">;
703703
}
704704

705-
let Features = "f16c",
705+
let Features = "f16c",
706706
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<256>] in {
707707
def vcvtps2ph256 : X86Builtin<"_Vector<8, short>(_Vector<8, float>, _Constant int)">;
708708
}

clang/lib/AST/ByteCode/InterpBuiltin.cpp

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3030,11 +3030,20 @@ static bool interp__builtin_ia32_vcvtps2ph(InterpState &S, CodePtr OpPC,
30303030
llvm::RoundingMode RM;
30313031
if (!UseMXCSR) {
30323032
switch (ImmVal & 3) {
3033-
case 0: RM = llvm::RoundingMode::NearestTiesToEven; break;
3034-
case 1: RM = llvm::RoundingMode::TowardNegative; break;
3035-
case 2: RM = llvm::RoundingMode::TowardPositive; break;
3036-
case 3: RM = llvm::RoundingMode::TowardZero; break;
3037-
default: llvm_unreachable("Invalid immediate rounding mode");
3033+
case 0:
3034+
RM = llvm::RoundingMode::NearestTiesToEven;
3035+
break;
3036+
case 1:
3037+
RM = llvm::RoundingMode::TowardNegative;
3038+
break;
3039+
case 2:
3040+
RM = llvm::RoundingMode::TowardPositive;
3041+
break;
3042+
case 3:
3043+
RM = llvm::RoundingMode::TowardZero;
3044+
break;
3045+
default:
3046+
llvm_unreachable("Invalid immediate rounding mode");
30383047
}
30393048
} else {
30403049
// For MXCSR, we must check for exactness. We can use any rounding mode
@@ -3054,7 +3063,8 @@ static bool interp__builtin_ia32_vcvtps2ph(InterpState &S, CodePtr OpPC,
30543063
APFloat::opStatus St = DstVal.convert(HalfSem, RM, &LostInfo);
30553064

30563065
if (UseMXCSR && St != APFloat::opOK) {
3057-
S.FFDiag(S.Current->getSource(OpPC), diag::note_constexpr_dynamic_rounding);
3066+
S.FFDiag(S.Current->getSource(OpPC),
3067+
diag::note_constexpr_dynamic_rounding);
30583068
return false;
30593069
}
30603070

@@ -3069,12 +3079,10 @@ static bool interp__builtin_ia32_vcvtps2ph(InterpState &S, CodePtr OpPC,
30693079
// (e.g., vcvtps2ph converting 4 floats to 8 shorts).
30703080
if (DstNumElems > SrcNumElems) {
30713081
for (unsigned I = SrcNumElems; I < DstNumElems; ++I) {
3072-
INT_TYPE_SWITCH_NO_BOOL(DstElemT, {
3073-
Dst.elem<T>(I) = T::from(0);
3074-
});
3082+
INT_TYPE_SWITCH_NO_BOOL(DstElemT, { Dst.elem<T>(I) = T::from(0); });
30753083
}
30763084
}
3077-
3085+
30783086
Dst.initializeAllElements();
30793087
return true;
30803088
}
@@ -3921,7 +3929,7 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
39213929
case X86::BI__builtin_ia32_vinsertf128_si256:
39223930
case X86::BI__builtin_ia32_insert128i256:
39233931
return interp__builtin_x86_insert_subvector(S, OpPC, Call, BuiltinID);
3924-
3932+
39253933
case clang::X86::BI__builtin_ia32_vcvtps2ph:
39263934
case clang::X86::BI__builtin_ia32_vcvtps2ph256:
39273935
return interp__builtin_ia32_vcvtps2ph(S, OpPC, Call);

clang/lib/AST/ExprConstant.cpp

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12461,19 +12461,29 @@ bool VectorExprEvaluator::VisitCallExpr(const CallExpr *E) {
1246112461
unsigned DstNumElems = DstVTy->getNumElements();
1246212462
QualType DstElemTy = DstVTy->getElementType();
1246312463

12464-
const llvm::fltSemantics &HalfSem = Info.Ctx.getFloatTypeSemantics(Info.Ctx.HalfTy);
12464+
const llvm::fltSemantics &HalfSem =
12465+
Info.Ctx.getFloatTypeSemantics(Info.Ctx.HalfTy);
1246512466

1246612467
int ImmVal = Imm.getZExtValue();
1246712468
bool UseMXCSR = (ImmVal & 4) != 0;
1246812469

1246912470
llvm::RoundingMode RM;
1247012471
if (!UseMXCSR) {
1247112472
switch (ImmVal & 3) {
12472-
case 0: RM = llvm::RoundingMode::NearestTiesToEven; break;
12473-
case 1: RM = llvm::RoundingMode::TowardNegative; break;
12474-
case 2: RM = llvm::RoundingMode::TowardPositive; break;
12475-
case 3: RM = llvm::RoundingMode::TowardZero; break;
12476-
default: llvm_unreachable("Invalid immediate rounding mode");
12473+
case 0:
12474+
RM = llvm::RoundingMode::NearestTiesToEven;
12475+
break;
12476+
case 1:
12477+
RM = llvm::RoundingMode::TowardNegative;
12478+
break;
12479+
case 2:
12480+
RM = llvm::RoundingMode::TowardPositive;
12481+
break;
12482+
case 3:
12483+
RM = llvm::RoundingMode::TowardZero;
12484+
break;
12485+
default:
12486+
llvm_unreachable("Invalid immediate rounding mode");
1247712487
}
1247812488
} else {
1247912489
RM = llvm::RoundingMode::NearestTiesToEven;
@@ -12484,15 +12494,15 @@ bool VectorExprEvaluator::VisitCallExpr(const CallExpr *E) {
1248412494

1248512495
for (unsigned I = 0; I < SrcNumElems; ++I) {
1248612496
APFloat SrcVal = SrcVec.getVectorElt(I).getFloat();
12487-
12497+
1248812498
bool LostInfo;
1248912499
APFloat::opStatus St = SrcVal.convert(HalfSem, RM, &LostInfo);
1249012500

1249112501
if (UseMXCSR && St != APFloat::opOK) {
1249212502
Info.FFDiag(E, diag::note_constexpr_dynamic_rounding);
1249312503
return false;
1249412504
}
12495-
12505+
1249612506
APSInt DstInt(SrcVal.bitcastToAPInt(),
1249712507
DstElemTy->isUnsignedIntegerOrEnumerationType());
1249812508
ResultElements.push_back(APValue(DstInt));

0 commit comments

Comments
 (0)