@@ -864,6 +864,9 @@ bool X86TargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
864
864
// / definitions for this particular subtarget.
865
865
void X86TargetInfo::getTargetDefines (const LangOptions &Opts,
866
866
MacroBuilder &Builder) const {
867
+ // Inline assembly supports X86 flag outputs.
868
+ Builder.defineMacro (" __GCC_ASM_FLAG_OUTPUTS__" );
869
+
867
870
std::string CodeModel = getTargetOpts ().CodeModel ;
868
871
if (CodeModel == " default" )
869
872
CodeModel = " small" ;
@@ -1553,6 +1556,40 @@ bool X86TargetInfo::validateCpuIs(StringRef FeatureStr) const {
1553
1556
.Default (false );
1554
1557
}
1555
1558
1559
+ static unsigned matchAsmCCConstraint (const char *&Name) {
1560
+ auto RV = llvm::StringSwitch<unsigned >(Name)
1561
+ .Case (" @cca" , 4 )
1562
+ .Case (" @ccae" , 5 )
1563
+ .Case (" @ccb" , 4 )
1564
+ .Case (" @ccbe" , 5 )
1565
+ .Case (" @ccc" , 4 )
1566
+ .Case (" @cce" , 4 )
1567
+ .Case (" @ccz" , 4 )
1568
+ .Case (" @ccg" , 4 )
1569
+ .Case (" @ccge" , 5 )
1570
+ .Case (" @ccl" , 4 )
1571
+ .Case (" @ccle" , 5 )
1572
+ .Case (" @ccna" , 5 )
1573
+ .Case (" @ccnae" , 6 )
1574
+ .Case (" @ccnb" , 5 )
1575
+ .Case (" @ccnbe" , 6 )
1576
+ .Case (" @ccnc" , 5 )
1577
+ .Case (" @ccne" , 5 )
1578
+ .Case (" @ccnz" , 5 )
1579
+ .Case (" @ccng" , 5 )
1580
+ .Case (" @ccnge" , 6 )
1581
+ .Case (" @ccnl" , 5 )
1582
+ .Case (" @ccnle" , 6 )
1583
+ .Case (" @ccno" , 5 )
1584
+ .Case (" @ccnp" , 5 )
1585
+ .Case (" @ccns" , 5 )
1586
+ .Case (" @cco" , 4 )
1587
+ .Case (" @ccp" , 4 )
1588
+ .Case (" @ccs" , 4 )
1589
+ .Default (0 );
1590
+ return RV;
1591
+ }
1592
+
1556
1593
bool X86TargetInfo::validateAsmConstraint (
1557
1594
const char *&Name, TargetInfo::ConstraintInfo &Info) const {
1558
1595
switch (*Name) {
@@ -1635,6 +1672,14 @@ bool X86TargetInfo::validateAsmConstraint(
1635
1672
case ' C' : // SSE floating point constant.
1636
1673
case ' G' : // x87 floating point constant.
1637
1674
return true ;
1675
+ case ' @' :
1676
+ // CC condition changes.
1677
+ if (auto Len = matchAsmCCConstraint (Name)) {
1678
+ Name += Len - 1 ;
1679
+ Info.setAllowsRegister ();
1680
+ return true ;
1681
+ }
1682
+ return false ;
1638
1683
}
1639
1684
}
1640
1685
@@ -1706,6 +1751,13 @@ bool X86TargetInfo::validateOperandSize(StringRef Constraint,
1706
1751
1707
1752
std::string X86TargetInfo::convertConstraint (const char *&Constraint) const {
1708
1753
switch (*Constraint) {
1754
+ case ' @' :
1755
+ if (auto Len = matchAsmCCConstraint (Constraint)) {
1756
+ std::string Converted = " {" + std::string (Constraint, Len) + " }" ;
1757
+ Constraint += Len - 1 ;
1758
+ return Converted;
1759
+ }
1760
+ return std::string (1 , *Constraint);
1709
1761
case ' a' :
1710
1762
return std::string (" {ax}" );
1711
1763
case ' b' :
0 commit comments