llvm.org GIT mirror llvm / 418d565
AMDGPU: Disallow flat_scr in SI assembler git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254459 91177308-0d34-0410-b5e6-96231b3b80d8 Matt Arsenault 4 years ago
2 changed file(s) with 52 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
331331
332332 unsigned ForcedEncodingSize;
333333
334 bool isSI() const {
335 return STI->getFeatureBits()[AMDGPU::FeatureSouthernIslands];
336 }
337
338 bool isCI() const {
339 return STI->getFeatureBits()[AMDGPU::FeatureSeaIslands];
340 }
341
334342 bool isVI() const {
335343 return getSTI().getFeatureBits()[AMDGPU::FeatureVolcanicIslands];
336344 }
503511 const AsmToken Tok = Parser.getTok();
504512 StartLoc = Tok.getLoc();
505513 EndLoc = Tok.getEndLoc();
514 const MCRegisterInfo *TRI = getContext().getRegisterInfo();
515
506516 StringRef RegName = Tok.getString();
507517 RegNo = getRegForName(RegName);
508518
509519 if (RegNo) {
510520 Parser.Lex();
511 return false;
521 return !subtargetHasRegister(*TRI, RegNo);
512522 }
513523
514524 // Match vgprs and sgprs
561571 }
562572 }
563573
564 const MCRegisterInfo *TRI = getContext().getRegisterInfo();
565574 int RCID = getRegClass(IsVgpr, RegWidth);
566575 if (RCID == -1)
567576 return true;
979988
980989 bool AMDGPUAsmParser::subtargetHasRegister(const MCRegisterInfo &MRI,
981990 unsigned RegNo) const {
982 if (!isVI())
991 if (isCI())
983992 return true;
993
994 if (isSI()) {
995 // No flat_scr
996 switch (RegNo) {
997 case AMDGPU::FLAT_SCR:
998 case AMDGPU::FLAT_SCR_LO:
999 case AMDGPU::FLAT_SCR_HI:
1000 return false;
1001 default:
1002 return true;
1003 }
1004 }
9841005
9851006 // VI only has 102 SGPRs, so make sure we aren't trying to use the 2 more that
9861007 // SI/CI have.
0 // RUN: not llvm-mc -arch=amdgcn -mcpu=tahiti %s 2>&1 | FileCheck -check-prefix=GCN -check-prefix=SI %s
1 // RUN: not llvm-mc -arch=amdgcn -mcpu=hawaii %s 2>&1 | FileCheck -check-prefix=GCN -check-prefix=CI %s
2 // RUN: not llvm-mc -arch=amdgcn -mcpu=tonga %s 2>&1 | FileCheck -check-prefix=GCN -check-prefix=VI %s
3
4 s_mov_b64 flat_scratch, -1
5 // SI: error: invalid operand for instruction
6 // CI-NOT: error
7 // VI-NOT: error
8
9 s_mov_b32 flat_scratch_lo, -1
10 // SI: error: invalid operand for instruction
11 // CI-NOT: error
12 // VI-NOT: error
13
14 s_mov_b32 flat_scratch_hi, -1
15 // SI: error: invalid operand for instruction
16 // CI-NOT: error
17 // VI-NOT: error
18
19
20 s_mov_b64 flat_scratch_lo, -1
21 // GCN: error: invalid operand for instruction
22
23 s_mov_b64 flat_scratch_hi, -1
24 // GCN: error: invalid operand for instruction
25
26 s_mov_b32 flat_scratch, -1
27 // GCN: error: invalid operand for instruction