Skip to content

Commit 8de6939

Browse files
committed
clang format
1 parent dbcb924 commit 8de6939

File tree

4 files changed

+121
-104
lines changed

4 files changed

+121
-104
lines changed

clang/include/clang/Basic/BuiltinsX86.td

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,81 +1272,99 @@ let Features = "avx512bw", Attributes = [NoThrow, Const, Constexpr] in {
12721272
def knotdi : X86Builtin<"unsigned long long int(unsigned long long int)">;
12731273
}
12741274

1275-
let Features = "avx512vl,avx512bw", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
1275+
let Features = "avx512vl,avx512bw",
1276+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
12761277
def cmpb128_mask : X86Builtin<"unsigned short(_Vector<16, char>, _Vector<16, char>, _Constant int, unsigned short)">;
12771278
}
12781279

1279-
let Features = "avx512vl", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
1280+
let Features = "avx512vl",
1281+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
12801282
def cmpd128_mask : X86Builtin<"unsigned char(_Vector<4, int>, _Vector<4, int>, _Constant int, unsigned char)">;
12811283
def cmpq128_mask : X86Builtin<"unsigned char(_Vector<2, long long int>, _Vector<2, long long int>, _Constant int, unsigned char)">;
12821284
}
12831285

1284-
let Features = "avx512vl,avx512bw", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
1286+
let Features = "avx512vl,avx512bw",
1287+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
12851288
def cmpw128_mask : X86Builtin<"unsigned char(_Vector<8, short>, _Vector<8, short>, _Constant int, unsigned char)">;
12861289
}
12871290

1288-
let Features = "avx512vl,avx512bw", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<256>] in {
1291+
let Features = "avx512vl,avx512bw",
1292+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<256>] in {
12891293
def cmpb256_mask : X86Builtin<"unsigned int(_Vector<32, char>, _Vector<32, char>, _Constant int, unsigned int)">;
12901294
}
12911295

1292-
let Features = "avx512vl", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<256>] in {
1296+
let Features = "avx512vl",
1297+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<256>] in {
12931298
def cmpd256_mask : X86Builtin<"unsigned char(_Vector<8, int>, _Vector<8, int>, _Constant int, unsigned char)">;
12941299
def cmpq256_mask : X86Builtin<"unsigned char(_Vector<4, long long int>, _Vector<4, long long int>, _Constant int, unsigned char)">;
12951300
}
12961301

1297-
let Features = "avx512vl,avx512bw", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<256>] in {
1302+
let Features = "avx512vl,avx512bw",
1303+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<256>] in {
12981304
def cmpw256_mask : X86Builtin<"unsigned short(_Vector<16, short>, _Vector<16, short>, _Constant int, unsigned short)">;
12991305
}
13001306

1301-
let Features = "avx512bw", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
1307+
let Features = "avx512bw",
1308+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
13021309
def cmpb512_mask : X86Builtin<"unsigned long long int(_Vector<64, char>, _Vector<64, char>, _Constant int, unsigned long long int)">;
13031310
}
13041311

1305-
let Features = "avx512f", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
1312+
let Features = "avx512f",
1313+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
13061314
def cmpd512_mask : X86Builtin<"unsigned short(_Vector<16, int>, _Vector<16, int>, _Constant int, unsigned short)">;
13071315
def cmpq512_mask : X86Builtin<"unsigned char(_Vector<8, long long int>, _Vector<8, long long int>, _Constant int, unsigned char)">;
13081316
}
13091317

1310-
let Features = "avx512bw", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
1318+
let Features = "avx512bw",
1319+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
13111320
def cmpw512_mask : X86Builtin<"unsigned int(_Vector<32, short>, _Vector<32, short>, _Constant int, unsigned int)">;
13121321
}
13131322

1314-
let Features = "avx512vl,avx512bw", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
1323+
let Features = "avx512vl,avx512bw",
1324+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
13151325
def ucmpb128_mask : X86Builtin<"unsigned short(_Vector<16, char>, _Vector<16, char>, _Constant int, unsigned short)">;
13161326
}
13171327

1318-
let Features = "avx512vl", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
1328+
let Features = "avx512vl",
1329+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
13191330
def ucmpd128_mask : X86Builtin<"unsigned char(_Vector<4, int>, _Vector<4, int>, _Constant int, unsigned char)">;
13201331
def ucmpq128_mask : X86Builtin<"unsigned char(_Vector<2, long long int>, _Vector<2, long long int>, _Constant int, unsigned char)">;
13211332
}
13221333

1323-
let Features = "avx512vl,avx512bw", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
1334+
let Features = "avx512vl,avx512bw",
1335+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
13241336
def ucmpw128_mask : X86Builtin<"unsigned char(_Vector<8, short>, _Vector<8, short>, _Constant int, unsigned char)">;
13251337
}
13261338

1327-
let Features = "avx512vl,avx512bw", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<256>] in {
1339+
let Features = "avx512vl,avx512bw",
1340+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<256>] in {
13281341
def ucmpb256_mask : X86Builtin<"unsigned int(_Vector<32, char>, _Vector<32, char>, _Constant int, unsigned int)">;
13291342
}
13301343

1331-
let Features = "avx512vl", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<256>] in {
1344+
let Features = "avx512vl",
1345+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<256>] in {
13321346
def ucmpd256_mask : X86Builtin<"unsigned char(_Vector<8, int>, _Vector<8, int>, _Constant int, unsigned char)">;
13331347
def ucmpq256_mask : X86Builtin<"unsigned char(_Vector<4, long long int>, _Vector<4, long long int>, _Constant int, unsigned char)">;
13341348
}
13351349

1336-
let Features = "avx512vl,avx512bw", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<256>] in {
1350+
let Features = "avx512vl,avx512bw",
1351+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<256>] in {
13371352
def ucmpw256_mask : X86Builtin<"unsigned short(_Vector<16, short>, _Vector<16, short>, _Constant int, unsigned short)">;
13381353
}
13391354

1340-
let Features = "avx512bw", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
1355+
let Features = "avx512bw",
1356+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
13411357
def ucmpb512_mask : X86Builtin<"unsigned long long int(_Vector<64, char>, _Vector<64, char>, _Constant int, unsigned long long int)">;
13421358
}
13431359

1344-
let Features = "avx512f", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
1360+
let Features = "avx512f",
1361+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
13451362
def ucmpd512_mask : X86Builtin<"unsigned short(_Vector<16, int>, _Vector<16, int>, _Constant int, unsigned short)">;
13461363
def ucmpq512_mask : X86Builtin<"unsigned char(_Vector<8, long long int>, _Vector<8, long long int>, _Constant int, unsigned char)">;
13471364
}
13481365

1349-
let Features = "avx512bw", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
1366+
let Features = "avx512bw",
1367+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
13501368
def ucmpw512_mask : X86Builtin<"unsigned int(_Vector<32, short>, _Vector<32, short>, _Constant int, unsigned int)">;
13511369
}
13521370

clang/lib/AST/ByteCode/InterpBuiltin.cpp

Lines changed: 53 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3101,61 +3101,61 @@ static bool interp__builtin_vec_set(InterpState &S, CodePtr OpPC,
31013101
return true;
31023102
}
31033103

3104-
static bool interp__builtin_cmp_mask(InterpState &S, CodePtr OpPC,
3105-
const CallExpr *Call, unsigned ID,
3106-
bool IsUnsigned) {
3107-
assert(Call->getNumArgs() == 4);
3104+
static bool interp__builtin_cmp_mask(InterpState &S, CodePtr OpPC,
3105+
const CallExpr *Call, unsigned ID,
3106+
bool IsUnsigned) {
3107+
assert(Call->getNumArgs() == 4);
31083108

3109-
APSInt Mask = popToAPSInt(S, Call->getArg(3));
3110-
APSInt Opcode = popToAPSInt(S, Call->getArg(2));
3111-
const Pointer &LHS = S.Stk.pop<Pointer>();
3112-
const Pointer &RHS = S.Stk.pop<Pointer>();
3113-
3114-
assert(LHS.getNumElems() == RHS.getNumElems());
3109+
APSInt Mask = popToAPSInt(S, Call->getArg(3));
3110+
APSInt Opcode = popToAPSInt(S, Call->getArg(2));
3111+
const Pointer &LHS = S.Stk.pop<Pointer>();
3112+
const Pointer &RHS = S.Stk.pop<Pointer>();
31153113

3116-
APInt RetMask = APInt::getZero(LHS.getNumElems());
3117-
unsigned VectorLen = LHS.getNumElems();
3118-
PrimType ElemT = LHS.getFieldDesc()->getPrimType();
3114+
assert(LHS.getNumElems() == RHS.getNumElems());
31193115

3120-
INT_TYPE_SWITCH_NO_BOOL(ElemT, {
3121-
for (unsigned ElemNum = 0; ElemNum < VectorLen; ++ElemNum) {
3122-
APSInt A = LHS.elem<T>(ElemNum).toAPSInt();
3123-
APSInt B = RHS.elem<T>(ElemNum).toAPSInt();
3124-
bool result = false;
3125-
switch (Opcode.getExtValue() & 0x7) {
3126-
case 0x00: // _MM_CMPINT_EQ
3127-
result = (A == B);
3128-
break;
3129-
case 0x01: // _MM_CMPINT_LT
3130-
result = IsUnsigned ? A.ult(B) : A.slt(B);
3131-
break;
3132-
case 0x02: // _MM_CMPINT_LE
3133-
result = IsUnsigned ? A.ule(B) : A.sle(B);
3134-
break;
3135-
case 0x03: // _MM_CMPINT_FALSE
3136-
result = false;
3137-
break;
3138-
case 0x04: // _MM_CMPINT_NE
3139-
result = (A != B);
3140-
break;
3141-
case 0x05: // _MM_CMPINT_NLT (>=)
3142-
result = IsUnsigned ? A.uge(B) : A.sge(B);
3143-
break;
3144-
case 0x06: // _MM_CMPINT_NLE (>)
3145-
result = IsUnsigned ? A.ugt(B) : A.sgt(B);
3146-
break;
3147-
case 0x07: // _MM_CMPINT_TRUE
3148-
result = true;
3149-
break;
3150-
}
3116+
APInt RetMask = APInt::getZero(LHS.getNumElems());
3117+
unsigned VectorLen = LHS.getNumElems();
3118+
PrimType ElemT = LHS.getFieldDesc()->getPrimType();
31513119

3152-
RetMask.setBitVal(ElemNum, Mask[ElemNum] && result);
3120+
INT_TYPE_SWITCH_NO_BOOL(ElemT, {
3121+
for (unsigned ElemNum = 0; ElemNum < VectorLen; ++ElemNum) {
3122+
APSInt A = LHS.elem<T>(ElemNum).toAPSInt();
3123+
APSInt B = RHS.elem<T>(ElemNum).toAPSInt();
3124+
bool result = false;
3125+
switch (Opcode.getExtValue() & 0x7) {
3126+
case 0x00: // _MM_CMPINT_EQ
3127+
result = (A == B);
3128+
break;
3129+
case 0x01: // _MM_CMPINT_LT
3130+
result = IsUnsigned ? A.ult(B) : A.slt(B);
3131+
break;
3132+
case 0x02: // _MM_CMPINT_LE
3133+
result = IsUnsigned ? A.ule(B) : A.sle(B);
3134+
break;
3135+
case 0x03: // _MM_CMPINT_FALSE
3136+
result = false;
3137+
break;
3138+
case 0x04: // _MM_CMPINT_NE
3139+
result = (A != B);
3140+
break;
3141+
case 0x05: // _MM_CMPINT_NLT (>=)
3142+
result = IsUnsigned ? A.uge(B) : A.sge(B);
3143+
break;
3144+
case 0x06: // _MM_CMPINT_NLE (>)
3145+
result = IsUnsigned ? A.ugt(B) : A.sgt(B);
3146+
break;
3147+
case 0x07: // _MM_CMPINT_TRUE
3148+
result = true;
3149+
break;
31533150
}
3154-
});
31553151

3156-
pushInteger(S, RetMask, Call->getType());
3157-
return true;
3158-
}
3152+
RetMask.setBitVal(ElemNum, Mask[ElemNum] && result);
3153+
}
3154+
});
3155+
3156+
pushInteger(S, RetMask, Call->getType());
3157+
return true;
3158+
}
31593159

31603160
static bool interp__builtin_ia32_vpconflict(InterpState &S, CodePtr OpPC,
31613161
const CallExpr *Call) {
@@ -4209,7 +4209,8 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
42094209
case X86::BI__builtin_ia32_cmpw512_mask:
42104210
case X86::BI__builtin_ia32_cmpd512_mask:
42114211
case X86::BI__builtin_ia32_cmpq512_mask:
4212-
return interp__builtin_cmp_mask(S, OpPC, Call, BuiltinID, /*IsUnsigned*/false);
4212+
return interp__builtin_cmp_mask(S, OpPC, Call, BuiltinID,
4213+
/*IsUnsigned*/ false);
42134214

42144215
case X86::BI__builtin_ia32_ucmpb128_mask:
42154216
case X86::BI__builtin_ia32_ucmpw128_mask:
@@ -4223,7 +4224,8 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
42234224
case X86::BI__builtin_ia32_ucmpw512_mask:
42244225
case X86::BI__builtin_ia32_ucmpd512_mask:
42254226
case X86::BI__builtin_ia32_ucmpq512_mask:
4226-
return interp__builtin_cmp_mask(S, OpPC, Call, BuiltinID, /*IsUnsigned*/true);
4227+
return interp__builtin_cmp_mask(S, OpPC, Call, BuiltinID,
4228+
/*IsUnsigned*/ true);
42274229

42284230
default:
42294231
S.FFDiag(S.Current->getLocation(OpPC),

clang/lib/AST/ExprConstant.cpp

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15476,8 +15476,9 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
1547615476
case clang::X86::BI__builtin_ia32_ucmpq512_mask: {
1547715477
assert(E->getNumArgs() == 4);
1547815478

15479-
bool IsUnsigned = (BuiltinOp >= clang::X86::BI__builtin_ia32_ucmpb128_mask &&
15480-
BuiltinOp <= clang::X86::BI__builtin_ia32_ucmpq512_mask);
15479+
bool IsUnsigned =
15480+
(BuiltinOp >= clang::X86::BI__builtin_ia32_ucmpb128_mask &&
15481+
BuiltinOp <= clang::X86::BI__builtin_ia32_ucmpq512_mask);
1548115482

1548215483
APValue LHS, RHS;
1548315484
APSInt Mask, Opcode;
@@ -15487,7 +15488,7 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
1548715488
!EvaluateInteger(E->getArg(3), Mask, Info))
1548815489
return false;
1548915490

15490-
assert(LHS.getVectorLength() == RHS.getVectorLength());
15491+
assert(LHS.getVectorLength() == RHS.getVectorLength());
1549115492

1549215493
APSInt RetMask = APSInt::getUnsigned(0);
1549315494
unsigned VectorLen = LHS.getVectorLength();
@@ -15498,30 +15499,30 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
1549815499
bool result = false;
1549915500

1550015501
switch (Opcode.getExtValue() & 0x7) {
15501-
case 0: // _MM_CMPINT_EQ
15502-
result = (A == B);
15503-
break;
15504-
case 1: // _MM_CMPINT_LT
15505-
result = IsUnsigned ? A.ult(B) : A.slt(B);
15506-
break;
15507-
case 2: // _MM_CMPINT_LE
15508-
result = IsUnsigned ? A.ule(B) : A.sle(B);
15509-
break;
15510-
case 3: // _MM_CMPINT_FALSE
15511-
result = false;
15512-
break;
15513-
case 4: // _MM_CMPINT_NE
15514-
result = (A != B);
15515-
break;
15516-
case 5: // _MM_CMPINT_NLT (>=)
15517-
result = IsUnsigned ? A.uge(B) : A.sge(B);
15518-
break;
15519-
case 6: // _MM_CMPINT_NLE (>)
15520-
result = IsUnsigned ? A.ugt(B) : A.sgt(B);
15521-
break;
15522-
case 7: // _MM_CMPINT_TRUE
15523-
result = true;
15524-
break;
15502+
case 0: // _MM_CMPINT_EQ
15503+
result = (A == B);
15504+
break;
15505+
case 1: // _MM_CMPINT_LT
15506+
result = IsUnsigned ? A.ult(B) : A.slt(B);
15507+
break;
15508+
case 2: // _MM_CMPINT_LE
15509+
result = IsUnsigned ? A.ule(B) : A.sle(B);
15510+
break;
15511+
case 3: // _MM_CMPINT_FALSE
15512+
result = false;
15513+
break;
15514+
case 4: // _MM_CMPINT_NE
15515+
result = (A != B);
15516+
break;
15517+
case 5: // _MM_CMPINT_NLT (>=)
15518+
result = IsUnsigned ? A.uge(B) : A.sge(B);
15519+
break;
15520+
case 6: // _MM_CMPINT_NLE (>)
15521+
result = IsUnsigned ? A.ugt(B) : A.sgt(B);
15522+
break;
15523+
case 7: // _MM_CMPINT_TRUE
15524+
result = true;
15525+
break;
1552515526
}
1552615527

1552715528
RetMask.setBitVal(ElemNum, Mask[ElemNum] && result);

clang/lib/Headers/avx512vlbwintrin.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2386,21 +2386,18 @@ _mm256_mask_storeu_epi8 (void *__P, __mmask32 __U, __m256i __A)
23862386
}
23872387

23882388
static __inline__ __mmask16 __DEFAULT_FN_ATTRS128_CONSTEXPR
2389-
_mm_test_epi8_mask (__m128i __A, __m128i __B)
2390-
{
2389+
_mm_test_epi8_mask(__m128i __A, __m128i __B) {
23912390
return _mm_cmpneq_epi8_mask (_mm_and_si128(__A, __B), _mm_setzero_si128());
23922391
}
23932392

23942393
static __inline__ __mmask16 __DEFAULT_FN_ATTRS128_CONSTEXPR
2395-
_mm_mask_test_epi8_mask (__mmask16 __U, __m128i __A, __m128i __B)
2396-
{
2394+
_mm_mask_test_epi8_mask(__mmask16 __U, __m128i __A, __m128i __B) {
23972395
return _mm_mask_cmpneq_epi8_mask (__U, _mm_and_si128 (__A, __B),
23982396
_mm_setzero_si128());
23992397
}
24002398

24012399
static __inline__ __mmask32 __DEFAULT_FN_ATTRS256_CONSTEXPR
2402-
_mm256_test_epi8_mask (__m256i __A, __m256i __B)
2403-
{
2400+
_mm256_test_epi8_mask(__m256i __A, __m256i __B) {
24042401
return _mm256_cmpneq_epi8_mask (_mm256_and_si256(__A, __B),
24052402
_mm256_setzero_si256());
24062403
}
@@ -2440,8 +2437,7 @@ _mm256_mask_test_epi16_mask (__mmask16 __U, __m256i __A, __m256i __B)
24402437
}
24412438

24422439
static __inline__ __mmask16 __DEFAULT_FN_ATTRS128_CONSTEXPR
2443-
_mm_testn_epi8_mask (__m128i __A, __m128i __B)
2444-
{
2440+
_mm_testn_epi8_mask(__m128i __A, __m128i __B) {
24452441
return _mm_cmpeq_epi8_mask (_mm_and_si128 (__A, __B), _mm_setzero_si128());
24462442
}
24472443

0 commit comments

Comments
 (0)