@@ -381,9 +381,10 @@ G4_Type G4_INST::getExecType() const
381
381
382
382
for (unsigned i = 0 ; i < G4_MAX_SRCS; i++)
383
383
{
384
- if (srcs[i] != NULL )
384
+ G4_Operand* src = getSrc (i);
385
+ if (src != NULL )
385
386
{
386
- G4_Type srcType = srcs[i] ->getType ();
387
+ G4_Type srcType = src ->getType ();
387
388
if (TypeSize (srcType) >= TypeSize (execType))
388
389
{
389
390
if (IS_DTYPE (srcType))
@@ -435,7 +436,8 @@ G4_Type G4_INST::getExecType2() const
435
436
436
437
for (unsigned i = 0 ; i < G4_MAX_SRCS; i++)
437
438
{
438
- if (srcs[i] == NULL )
439
+ G4_Operand* src = getSrc (i);
440
+ if (src == NULL )
439
441
{
440
442
continue ;
441
443
}
@@ -462,7 +464,7 @@ G4_Type G4_INST::getExecType2() const
462
464
}
463
465
else if (IS_DFTYPE (srcType) && !IS_DFTYPE (execType))
464
466
{
465
- execType = srcs[i] ->getType ();
467
+ execType = src ->getType ();
466
468
break ;
467
469
}
468
470
else if ((IS_FTYPE (srcType) || srcType == Type_VF) &&
@@ -1018,6 +1020,7 @@ bool G4_INST::isJEUPipeInstructionXe() const
1018
1020
return false ;
1019
1021
}
1020
1022
1023
+
1021
1024
bool G4_INST::isLongPipeInstructionXe () const
1022
1025
{
1023
1026
if (isJEUPipeInstructionXe ())
@@ -1036,6 +1039,7 @@ bool G4_INST::isLongPipeInstructionXe() const
1036
1039
return false ;
1037
1040
}
1038
1041
1042
+
1039
1043
const G4_Operand* dst = getDst ();
1040
1044
if (dst && isLongPipeType (dst->getType ()))
1041
1045
{
@@ -1074,6 +1078,7 @@ bool G4_INST::isIntegerPipeInstructionXe() const
1074
1078
return false ;
1075
1079
}
1076
1080
1081
+
1077
1082
if (builder.hasFixedCycleMathPipeline () &&
1078
1083
isMath ())
1079
1084
{
@@ -1110,6 +1115,7 @@ bool G4_INST::isFloatPipeInstructionXe() const
1110
1115
return false ;
1111
1116
}
1112
1117
1118
+
1113
1119
if (isLongPipeInstructionXe ())
1114
1120
{
1115
1121
return false ;
@@ -1186,6 +1192,7 @@ SB_INST_PIPE G4_INST::getDataTypePipeXe(G4_Type type)
1186
1192
1187
1193
SB_INST_PIPE G4_INST::getInstructionPipeXe ()
1188
1194
{
1195
+
1189
1196
if (isLongPipeInstructionXe ())
1190
1197
{
1191
1198
return PIPE_LONG;
@@ -3291,9 +3298,10 @@ bool G4_INST::isValidSymbolOperand(bool &dst_valid, bool *srcs_valid) const
3291
3298
3292
3299
for (unsigned i = 0 ; i < G4_MAX_SRCS; i++)
3293
3300
{
3294
- if (srcs[i] && srcs[i]->isSrcRegRegion () && srcs[i]->asSrcRegRegion ()->getBase ()->isRegVar ())
3301
+ G4_Operand* src = getSrc (i);
3302
+ if (src && src->isSrcRegRegion () && src->asSrcRegRegion ()->getBase ()->isRegVar ())
3295
3303
{
3296
- srcs_valid[i] = srcs[i] ->asSrcRegRegion ()->obeySymbolRegRule ();
3304
+ srcs_valid[i] = src ->asSrcRegRegion ()->obeySymbolRegRule ();
3297
3305
if (!srcs_valid[i])
3298
3306
obeyRule = false ;
3299
3307
}
@@ -3343,15 +3351,15 @@ bool G4_INST::isOptBarrier() const
3343
3351
3344
3352
for (int i = 0 ; i < getNumSrc (); i++)
3345
3353
{
3346
- if (srcs[i] )
3354
+ if (getSrc (i) )
3347
3355
{
3348
- if (srcs[i] ->isAreg ())
3356
+ if (getSrc (i) ->isAreg ())
3349
3357
{
3350
- if (srcs[i] ->isNReg () ||
3351
- srcs[i] ->isSrReg () ||
3352
- srcs[i] ->isCrReg () ||
3353
- srcs[i] ->isTmReg () ||
3354
- srcs[i] ->isTDRReg ())
3358
+ if (getSrc (i) ->isNReg () ||
3359
+ getSrc (i) ->isSrReg () ||
3360
+ getSrc (i) ->isCrReg () ||
3361
+ getSrc (i) ->isTmReg () ||
3362
+ getSrc (i) ->isTDRReg ())
3355
3363
{
3356
3364
return true ;
3357
3365
}
@@ -3483,19 +3491,20 @@ void G4_INST::emit_inst(std::ostream& output, bool symbol_dst, bool *symbol_srcs
3483
3491
auto numSrcOpnds = getNumSrc ();
3484
3492
for (int i = 0 ; i < numSrcOpnds; i++)
3485
3493
{
3486
- if (srcs[i] )
3494
+ if (getSrc (i) )
3487
3495
{
3488
3496
output << " " ;
3489
3497
if (symbol_srcs != NULL )
3490
3498
{
3491
- srcs[i] ->emit (output, symbol_srcs[i]); // emit symbolic/physical register depends on the flag
3499
+ getSrc (i) ->emit (output, symbol_srcs[i]); // emit symbolic/physical register depends on the flag
3492
3500
}
3493
3501
else
3494
3502
{
3495
- srcs[i] ->emit (output, false ); // emit physical register
3503
+ getSrc (i) ->emit (output, false ); // emit physical register
3496
3504
}
3497
3505
}
3498
3506
}
3507
+
3499
3508
if (isFillIntrinsic ())
3500
3509
{
3501
3510
output << " " ;
@@ -3622,7 +3631,7 @@ void G4_INST::emit_options(std::ostream& output) const
3622
3631
3623
3632
// //////////////////////////////////////////////////////////
3624
3633
// SWSB options
3625
- if (distanceHonourInstruction () && getDistance () != 0 ) {
3634
+ if (getDistance () != 0 ) {
3626
3635
std::stringstream dists;
3627
3636
switch (getDistanceTypeXe ()) {
3628
3637
case DistanceType::DIST: break ;
@@ -4366,8 +4375,6 @@ void printRegVarOff(std::ostream& output,
4366
4375
}
4367
4376
else if (baseVar->getPhyReg ()->isAreg ())
4368
4377
{
4369
- MUST_BE_TRUE (regOff == 0 , ERROR_INTERNAL_ARGUMENT);
4370
-
4371
4378
(static_cast <G4_Areg*>(baseVar->getPhyReg ()))->emit (output);
4372
4379
if (!baseVar->isNullReg ())
4373
4380
{
@@ -4444,7 +4451,9 @@ void printRegVarOff(std::ostream& output,
4444
4451
{
4445
4452
(static_cast <G4_Areg*>(baseVar->getPhyReg ()))->emit (output);
4446
4453
output << ' .' << (baseVar->getPhyRegOff () + subRegOffset);
4447
- output << " , " << immAddrOff << ' ]' ;
4454
+ {
4455
+ output << " , " << immAddrOff << ' ]' ;
4456
+ }
4448
4457
}
4449
4458
}
4450
4459
else // No register assigned yet
@@ -4458,7 +4467,9 @@ void printRegVarOff(std::ostream& output,
4458
4467
{
4459
4468
(static_cast <G4_Areg*>(base))->emit (output);
4460
4469
output << ' .' << subRegOffset;
4461
- output << " , " << immAddrOff << ' ]' ;
4470
+ {
4471
+ output << " , " << immAddrOff << ' ]' ;
4472
+ }
4462
4473
}
4463
4474
else
4464
4475
{
@@ -5559,6 +5570,10 @@ void G4_Declare::emit(std::ostream &output) const
5559
5570
{
5560
5571
output << ' a' ;
5561
5572
}
5573
+ else if (regFile == G4_SCALAR)
5574
+ {
5575
+ output << ' s' ;
5576
+ }
5562
5577
else if (regFile == G4_FLAG)
5563
5578
{
5564
5579
output << ' f' ;
@@ -7049,6 +7064,12 @@ void G4_INST::setPredicate(G4_Predicate* p)
7049
7064
7050
7065
void G4_INST::setSrc (G4_Operand* opnd, unsigned i)
7051
7066
{
7067
+ if (isPseudoAddrMovIntrinsic ())
7068
+ {
7069
+ asIntrinsicInst ()->setIntrinsicSrc (opnd, i);
7070
+ return ;
7071
+ }
7072
+
7052
7073
MUST_BE_TRUE (i < G4_MAX_SRCS, ERROR_INTERNAL_ARGUMENT);
7053
7074
7054
7075
if (srcs[i] != NULL )
@@ -8228,6 +8249,75 @@ G4_INST* G4_InstSend::cloneInst()
8228
8249
return newInst;
8229
8250
}
8230
8251
8252
+ G4_InstIntrinsic::G4_InstIntrinsic (
8253
+ const IR_Builder& builder,
8254
+ G4_Predicate* prd,
8255
+ Intrinsic intrinId,
8256
+ G4_ExecSize execSize,
8257
+ G4_DstRegRegion* d,
8258
+ G4_Operand* s0,
8259
+ G4_Operand* s1,
8260
+ G4_Operand* s2,
8261
+ G4_Operand* s3,
8262
+ G4_Operand* s4,
8263
+ G4_Operand* s5,
8264
+ G4_Operand* s6,
8265
+ G4_Operand* s7,
8266
+ G4_InstOpts opt) :
8267
+ G4_INST(builder, prd, G4_intrinsic, nullptr , g4::NOSAT, execSize, d, nullptr , nullptr , nullptr , opt),
8268
+ intrinsicId(intrinId), tmpGRFStart(-1 ), tmpAddrStart(-1 ), tmpFlagStart(-1 )
8269
+ {
8270
+ srcs[0 ] = s0;
8271
+ srcs[1 ] = s1;
8272
+ srcs[2 ] = s2;
8273
+ srcs[3 ] = s3;
8274
+ srcs[4 ] = s4;
8275
+ srcs[5 ] = s5;
8276
+ srcs[6 ] = s6;
8277
+ srcs[7 ] = s7;
8278
+
8279
+ resetRightBound (s0);
8280
+ resetRightBound (s1);
8281
+ resetRightBound (s2);
8282
+ resetRightBound (s3);
8283
+ resetRightBound (s4);
8284
+ resetRightBound (s5);
8285
+ resetRightBound (s6);
8286
+ resetRightBound (s7);
8287
+
8288
+ associateOpndWithInst (s0, this );
8289
+ associateOpndWithInst (s1, this );
8290
+ associateOpndWithInst (s2, this );
8291
+ associateOpndWithInst (s3, this );
8292
+ associateOpndWithInst (s4, this );
8293
+ associateOpndWithInst (s5, this );
8294
+ associateOpndWithInst (s6, this );
8295
+ associateOpndWithInst (s7, this );
8296
+ }
8297
+
8298
+ G4_Operand* G4_InstIntrinsic::getIntrinsicSrc (unsigned i) const
8299
+ {
8300
+ MUST_BE_TRUE (i < G4_MAX_INTRINSIC_SRCS, ERROR_INTERNAL_ARGUMENT);
8301
+ return srcs[i];
8302
+ }
8303
+
8304
+ void G4_InstIntrinsic::setIntrinsicSrc (G4_Operand* opnd, unsigned i)
8305
+ {
8306
+ MUST_BE_TRUE (i < G4_MAX_INTRINSIC_SRCS, ERROR_INTERNAL_ARGUMENT);
8307
+
8308
+ if (srcs[i] != NULL )
8309
+ {
8310
+ if (srcs[i]->getInst () == (G4_INST *)this )
8311
+ {
8312
+ srcs[i]->setInst (NULL );
8313
+ }
8314
+ }
8315
+ srcs[i] = opnd;
8316
+
8317
+ associateOpndWithInst (opnd, (G4_INST*)this );
8318
+ resetRightBound (opnd);
8319
+ }
8320
+
8231
8321
G4_INST* G4_InstIntrinsic::cloneInst ()
8232
8322
{
8233
8323
auto nonConstBuilder = const_cast <IR_Builder*>(&builder);
0 commit comments