llvm.org GIT mirror llvm / 776673e
X86: teach X86TargetLowering about L,M,O constraints Teach the ISelLowering for X86 about the L,M,O target specific constraints. Although, for the moment, clang performs constraint validation and prevents passing along inline asm which may have immediate constant constraints violated, the backend should be able to cope with the invalid inline asm a bit better. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225596 91177308-0d34-0410-b5e6-96231b3b80d8 Saleem Abdulrasool 5 years ago
2 changed file(s) with 59 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
2625426254 }
2625526255 }
2625626256 return;
26257 case 'L':
26258 if (ConstantSDNode *C = dyn_cast(Op)) {
26259 if (C->getZExtValue() == 0xff || C->getZExtValue() == 0xffff ||
26260 (Subtarget->is64Bit() && C->getZExtValue() == 0xffffffff)) {
26261 Result = DAG.getTargetConstant(C->getSExtValue(), Op.getValueType());
26262 break;
26263 }
26264 }
26265 return;
26266 case 'M':
26267 if (ConstantSDNode *C = dyn_cast(Op)) {
26268 if (C->getZExtValue() <= 3) {
26269 Result = DAG.getTargetConstant(C->getZExtValue(), Op.getValueType());
26270 break;
26271 }
26272 }
26273 return;
2625726274 case 'N':
2625826275 if (ConstantSDNode *C = dyn_cast(Op)) {
2625926276 if (C->getZExtValue() <= 255) {
26277 Result = DAG.getTargetConstant(C->getZExtValue(), Op.getValueType());
26278 break;
26279 }
26280 }
26281 return;
26282 case 'O':
26283 if (ConstantSDNode *C = dyn_cast(Op)) {
26284 if (C->getZExtValue() <= 127) {
2626026285 Result = DAG.getTargetConstant(C->getZExtValue(), Op.getValueType());
2626126286 break;
2626226287 }
0 ; RUN: llc -mtriple i686-gnu -filetype asm -o - %s 2>&1 | FileCheck %s
1
2 define void @test_L_ff() {
3 entry:
4 call void asm "", "L,~{dirflag},~{fpsr},~{flags}"(i32 255)
5 ret void
6 }
7
8 ; CHECK-NOT: error: invalid operand for inline asm constraint 'L'
9
10 define void @test_L_ffff() {
11 entry:
12 call void asm "", "L,~{dirflag},~{fpsr},~{flags}"(i32 65535)
13 ret void
14 }
15
16 ; CHECK-NOT: error: invalid operand for inline asm constraint 'L'
17
18 define void @test_M_1() {
19 entry:
20 call void asm "", "M,~{dirflag},~{fpsr},~{flags}"(i32 1)
21 ret void
22 }
23
24 ; CHECK-NOT: error: invalid operand for inline asm constraint 'M'
25
26 define void @test_O_64() {
27 entry:
28 call void asm "", "O,~{dirflag},~{fpsr},~{flags}"(i32 64)
29 ret void
30 }
31
32 ; CHECK-NOT: error: invalid operand for inline asm constraint 'O'
33