On Thursday 11 February 2010 13:31:58 David Greene wrote:> > Putting a bit (or multiple bits) in MachineMemOperand for this > > would also make sense. > > Is there any chance a MachineMemOperand will be shared by multiple > instructions?So I tried to do this: %r8 = load <2 x double>* %r6, align 16, !"nontemporal" and the assembler doesn't like it. Do I need to use named metadata? That would be rather inconvenient. The problem is this code in llvm-as: int LLParser::ParseLoad(Instruction *&Inst, PerFunctionState &PFS, bool isVolatile) { Value *Val; LocTy Loc; unsigned Alignment = 0; bool AteExtraComma = false; if (ParseTypeAndValue(Val, Loc, PFS) || ParseOptionalCommaAlign(Alignment, AteExtraComma)) return true; [...] } /// ParseOptionalCommaAlign /// ::= /// ::= ',' align 4 /// /// This returns with AteExtraComma set to true if it ate an excess comma at the /// end. bool LLParser::ParseOptionalCommaAlign(unsigned &Alignment, bool &AteExtraComma) { AteExtraComma = false; while (EatIfPresent(lltok::comma)) { // Metadata at the end is an early exit. if (Lex.getKind() == lltok::MetadataVar) { AteExtraComma = true; return false; } if (Lex.getKind() == lltok::kw_align) { if (ParseOptionalAlignment(Alignment)) return true; } else return true; } return false; } Either ParseLoad and probably other instructions need to look for metadata explicitly or ParseOptionalCommaAlign needs to know about general metadata. My inkling is to fix ParseOptionalCommaAlign. Sound reasonable? -Dave
On Thursday 11 February 2010 14:05:21 David Greene wrote:> Either ParseLoad and probably other instructions need to look for metadata > explicitly or ParseOptionalCommaAlign needs to know about general metadata. > > My inkling is to fix ParseOptionalCommaAlign. Sound reasonable?Well, that's a rat's nest. I backed up and thought maybe I have the metadata syntax wrong. So I tried a bunch of things: %r8 = load <2 x double>* %r6, align 16, metadata !"nontemporal" %r8 = load <2 x double>* %r6, align 16, metadata !nontemporal %r8 = load <2 x double>* %r6, align 16, !{ metadata !"nontemporal" } %r8 = load <2 x double>* %r6, align 16, !{ metadata !nontemporal } %r8 = load <2 x double>* %r6, align 16, !{ !"nontemporal" } %r8 = load <2 x double>* %r6, align 16, !{ !nontemporal } I give up! What is the syntax for attaching metadata to instructions? The documentation is very unclear. -Dave
On Feb 11, 2010, at 12:50 PM, David Greene wrote:> On Thursday 11 February 2010 14:05:21 David Greene wrote: > >> Either ParseLoad and probably other instructions need to look for metadata >> explicitly or ParseOptionalCommaAlign needs to know about general metadata. >> >> My inkling is to fix ParseOptionalCommaAlign. Sound reasonable? > > Well, that's a rat's nest. I backed up and thought maybe I have the metadata > syntax wrong. > > So I tried a bunch of things: > > %r8 = load <2 x double>* %r6, align 16, metadata !"nontemporal" > %r8 = load <2 x double>* %r6, align 16, metadata !nontemporal > %r8 = load <2 x double>* %r6, align 16, !{ metadata !"nontemporal" } > %r8 = load <2 x double>* %r6, align 16, !{ metadata !nontemporal } > %r8 = load <2 x double>* %r6, align 16, !{ !"nontemporal" } > %r8 = load <2 x double>* %r6, align 16, !{ !nontemporal } > > I give up! What is the syntax for attaching metadata to instructions? The > documentation is very unclear.Some examples are in llvm/test/Feature/md_on_instruction.ll Or you could just compile a file with -g. -Chris
On Thu, Feb 11, 2010 at 8:50 PM, David Greene <dag at cray.com> wrote:> > So I tried a bunch of things: > > %r8 = load <2 x double>* %r6, align 16, metadata !"nontemporal" > %r8 = load <2 x double>* %r6, align 16, metadata !nontemporal > %r8 = load <2 x double>* %r6, align 16, !{ metadata !"nontemporal" } > %r8 = load <2 x double>* %r6, align 16, !{ metadata !nontemporal } > %r8 = load <2 x double>* %r6, align 16, !{ !"nontemporal" } > %r8 = load <2 x double>* %r6, align 16, !{ !nontemporal } > > I give up! What is the syntax for attaching metadata to instructions?Try %r8 = load <2 x double>* %r6, align 16, !nontemporal !1 !1 = metadata !{ i32 1, metadata !0, null, metadata !"foobar" } - Devang