Skip to content

Commit 6c0574c

Browse files
committed
clang format
1 parent 8ab3da3 commit 6c0574c

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
@@ -693,12 +693,12 @@ let Features = "avx2", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
693693
def gatherq_d : X86Builtin<"_Vector<4, int>(_Vector<4, int>, int const *, _Vector<2, long long int>, _Vector<4, int>, _Constant char)">;
694694
}
695695

696-
let Features = "f16c",
696+
let Features = "f16c",
697697
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
698698
def vcvtps2ph : X86Builtin<"_Vector<8, short>(_Vector<4, float>, _Constant int)">;
699699
}
700700

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

clang/lib/AST/ByteCode/InterpBuiltin.cpp

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2906,11 +2906,20 @@ static bool interp__builtin_ia32_vcvtps2ph(InterpState &S, CodePtr OpPC,
29062906
llvm::RoundingMode RM;
29072907
if (!UseMXCSR) {
29082908
switch (ImmVal & 3) {
2909-
case 0: RM = llvm::RoundingMode::NearestTiesToEven; break;
2910-
case 1: RM = llvm::RoundingMode::TowardNegative; break;
2911-
case 2: RM = llvm::RoundingMode::TowardPositive; break;
2912-
case 3: RM = llvm::RoundingMode::TowardZero; break;
2913-
default: llvm_unreachable("Invalid immediate rounding mode");
2909+
case 0:
2910+
RM = llvm::RoundingMode::NearestTiesToEven;
2911+
break;
2912+
case 1:
2913+
RM = llvm::RoundingMode::TowardNegative;
2914+
break;
2915+
case 2:
2916+
RM = llvm::RoundingMode::TowardPositive;
2917+
break;
2918+
case 3:
2919+
RM = llvm::RoundingMode::TowardZero;
2920+
break;
2921+
default:
2922+
llvm_unreachable("Invalid immediate rounding mode");
29142923
}
29152924
} else {
29162925
// For MXCSR, we must check for exactness. We can use any rounding mode
@@ -2930,7 +2939,8 @@ static bool interp__builtin_ia32_vcvtps2ph(InterpState &S, CodePtr OpPC,
29302939
APFloat::opStatus St = DstVal.convert(HalfSem, RM, &LostInfo);
29312940

29322941
if (UseMXCSR && St != APFloat::opOK) {
2933-
S.FFDiag(S.Current->getSource(OpPC), diag::note_constexpr_dynamic_rounding);
2942+
S.FFDiag(S.Current->getSource(OpPC),
2943+
diag::note_constexpr_dynamic_rounding);
29342944
return false;
29352945
}
29362946

@@ -2945,12 +2955,10 @@ static bool interp__builtin_ia32_vcvtps2ph(InterpState &S, CodePtr OpPC,
29452955
// (e.g., vcvtps2ph converting 4 floats to 8 shorts).
29462956
if (DstNumElems > SrcNumElems) {
29472957
for (unsigned I = SrcNumElems; I < DstNumElems; ++I) {
2948-
INT_TYPE_SWITCH_NO_BOOL(DstElemT, {
2949-
Dst.elem<T>(I) = T::from(0);
2950-
});
2958+
INT_TYPE_SWITCH_NO_BOOL(DstElemT, { Dst.elem<T>(I) = T::from(0); });
29512959
}
29522960
}
2953-
2961+
29542962
Dst.initializeAllElements();
29552963
return true;
29562964
}
@@ -3762,7 +3770,7 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
37623770
case X86::BI__builtin_ia32_vinsertf128_si256:
37633771
case X86::BI__builtin_ia32_insert128i256:
37643772
return interp__builtin_x86_insert_subvector(S, OpPC, Call, BuiltinID);
3765-
3773+
37663774
case clang::X86::BI__builtin_ia32_vcvtps2ph:
37673775
case clang::X86::BI__builtin_ia32_vcvtps2ph256:
37683776
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
@@ -12254,19 +12254,29 @@ bool VectorExprEvaluator::VisitCallExpr(const CallExpr *E) {
1225412254
unsigned DstNumElems = DstVTy->getNumElements();
1225512255
QualType DstElemTy = DstVTy->getElementType();
1225612256

12257-
const llvm::fltSemantics &HalfSem = Info.Ctx.getFloatTypeSemantics(Info.Ctx.HalfTy);
12257+
const llvm::fltSemantics &HalfSem =
12258+
Info.Ctx.getFloatTypeSemantics(Info.Ctx.HalfTy);
1225812259

1225912260
int ImmVal = Imm.getZExtValue();
1226012261
bool UseMXCSR = (ImmVal & 4) != 0;
1226112262

1226212263
llvm::RoundingMode RM;
1226312264
if (!UseMXCSR) {
1226412265
switch (ImmVal & 3) {
12265-
case 0: RM = llvm::RoundingMode::NearestTiesToEven; break;
12266-
case 1: RM = llvm::RoundingMode::TowardNegative; break;
12267-
case 2: RM = llvm::RoundingMode::TowardPositive; break;
12268-
case 3: RM = llvm::RoundingMode::TowardZero; break;
12269-
default: llvm_unreachable("Invalid immediate rounding mode");
12266+
case 0:
12267+
RM = llvm::RoundingMode::NearestTiesToEven;
12268+
break;
12269+
case 1:
12270+
RM = llvm::RoundingMode::TowardNegative;
12271+
break;
12272+
case 2:
12273+
RM = llvm::RoundingMode::TowardPositive;
12274+
break;
12275+
case 3:
12276+
RM = llvm::RoundingMode::TowardZero;
12277+
break;
12278+
default:
12279+
llvm_unreachable("Invalid immediate rounding mode");
1227012280
}
1227112281
} else {
1227212282
RM = llvm::RoundingMode::NearestTiesToEven;
@@ -12277,15 +12287,15 @@ bool VectorExprEvaluator::VisitCallExpr(const CallExpr *E) {
1227712287

1227812288
for (unsigned I = 0; I < SrcNumElems; ++I) {
1227912289
APFloat SrcVal = SrcVec.getVectorElt(I).getFloat();
12280-
12290+
1228112291
bool LostInfo;
1228212292
APFloat::opStatus St = SrcVal.convert(HalfSem, RM, &LostInfo);
1228312293

1228412294
if (UseMXCSR && St != APFloat::opOK) {
1228512295
Info.FFDiag(E, diag::note_constexpr_dynamic_rounding);
1228612296
return false;
1228712297
}
12288-
12298+
1228912299
APSInt DstInt(SrcVal.bitcastToAPInt(),
1229012300
DstElemTy->isUnsignedIntegerOrEnumerationType());
1229112301
ResultElements.push_back(APValue(DstInt));

0 commit comments

Comments
 (0)