llvm.org GIT mirror llvm / c886c46
This is possible: vr1 = extract_subreg vr2, 3 ... vr3 = extract_subreg vr1, 2 The end result is vr3 is equal to vr2 with subidx 2. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47592 91177308-0d34-0410-b5e6-96231b3b80d8 Evan Cheng 11 years ago
2 changed file(s) with 63 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
456456 O.setSubReg(0);
457457 } else {
458458 unsigned OldSubIdx = O.getSubReg();
459 assert((!SubIdx || !OldSubIdx) && "Conflicting sub-register index!");
460 if (SubIdx)
459 // Sub-register indexes goes from small to large. e.g.
460 // RAX: 0 -> AL, 1 -> AH, 2 -> AX, 3 -> EAX
461 // EAX: 0 -> AL, 1 -> AH, 2 -> AX
462 // So RAX's sub-register 2 is AX, RAX's sub-regsiter 3 is EAX, whose
463 // sub-register 2 is also AX.
464 if (SubIdx && OldSubIdx && SubIdx != OldSubIdx)
465 assert(OldSubIdx < SubIdx && "Conflicting sub-register index!");
466 else if (SubIdx)
461467 O.setSubReg(SubIdx);
462468 O.setReg(DstReg);
463469 }
0 ; RUN: llvm-as < %s | llc -march=x86-64
1
2 %struct.XX = type <{ i8 }>
3 %struct.YY = type { i64 }
4 %struct.ZZ = type opaque
5
6 define i8 @f(%struct.XX*** %fontMap, %struct.XX* %uen) signext {
7 entry:
8 %tmp45 = add i16 0, 1 ; [#uses=2]
9 br i1 false, label %bb124, label %bb53
10
11 bb53: ; preds = %entry
12 %tmp55 = call %struct.YY** @AA( i64 1, %struct.XX* %uen ) ; <%struct.YY**> [#uses=3]
13 %tmp2728128 = load %struct.XX** null ; <%struct.XX*> [#uses=1]
14 %tmp61 = load %struct.YY** %tmp55, align 8 ; <%struct.YY*> [#uses=1]
15 %tmp62 = getelementptr %struct.YY* %tmp61, i32 0, i32 0 ; [#uses=1]
16 %tmp63 = load i64* %tmp62, align 8 ; [#uses=1]
17 %tmp6566 = zext i16 %tmp45 to i64 ; [#uses=1]
18 %tmp67 = shl i64 %tmp6566, 1 ; [#uses=1]
19 call void @BB( %struct.YY** %tmp55, i64 %tmp67, i8 signext 0, %struct.XX* %uen )
20 %tmp121131 = icmp eq i16 %tmp45, 1 ; [#uses=1]
21 br i1 %tmp121131, label %bb124, label %bb70.preheader
22
23 bb70.preheader: ; preds = %bb53
24 %tmp72 = bitcast %struct.XX* %tmp2728128 to %struct.ZZ*** ; <%struct.ZZ***> [#uses=1]
25 br label %bb70
26
27 bb70: ; preds = %bb119, %bb70.preheader
28 %indvar133 = phi i32 [ %indvar.next134, %bb119 ], [ 0, %bb70.preheader ] ; [#uses=2]
29 %tmp.135 = trunc i64 %tmp63 to i32 ; [#uses=1]
30 %tmp136 = shl i32 %indvar133, 1 ; [#uses=1]
31 %DD = add i32 %tmp136, %tmp.135 ; [#uses=1]
32 %tmp73 = load %struct.ZZ*** %tmp72, align 8 ; <%struct.ZZ**> [#uses=0]
33 br i1 false, label %bb119, label %bb77
34
35 bb77: ; preds = %bb70
36 %tmp8384 = trunc i32 %DD to i16 ; [#uses=1]
37 %tmp85 = sub i16 0, %tmp8384 ; [#uses=1]
38 store i16 %tmp85, i16* null, align 8
39 call void @CC( %struct.YY** %tmp55, i64 0, i64 2, i8* null, %struct.XX* %uen )
40 ret i8 0
41
42 bb119: ; preds = %bb70
43 %indvar.next134 = add i32 %indvar133, 1 ; [#uses=1]
44 br label %bb70
45
46 bb124: ; preds = %bb53, %entry
47 ret i8 undef
48 }
49
50 declare %struct.YY** @AA(i64, %struct.XX*)
51
52 declare void @BB(%struct.YY**, i64, i8 signext , %struct.XX*)
53
54 declare void @CC(%struct.YY**, i64, i64, i8*, %struct.XX*)