@@ -334,6 +334,7 @@ var optab = []Optab{
334
334
{ABC , C_SCON , C_REG , C_NONE , C_SBRA , 16 , 4 , 0 },
335
335
{ABC , C_SCON , C_REG , C_NONE , C_LBRA , 17 , 4 , 0 },
336
336
{ABR , C_NONE , C_NONE , C_NONE , C_LR , 18 , 4 , 0 },
337
+ {ABR , C_NONE , C_NONE , C_SCON , C_LR , 18 , 4 , 0 },
337
338
{ABR , C_NONE , C_NONE , C_NONE , C_CTR , 18 , 4 , 0 },
338
339
{ABR , C_REG , C_NONE , C_NONE , C_CTR , 18 , 4 , 0 },
339
340
{ABR , C_NONE , C_NONE , C_NONE , C_ZOREG , 15 , 8 , 0 },
@@ -2844,6 +2845,7 @@ func (c *ctxt9) asmout(p *obj.Prog, o *Optab, out []uint32) {
2844
2845
2845
2846
case 18 : /* br/bl (lr/ctr); bc/bcl bo,bi,(lr/ctr) */
2846
2847
var v int32
2848
+ var bh uint32 = 0
2847
2849
if p .As == ABC || p .As == ABCL {
2848
2850
v = c .regoff (& p .From ) & 31
2849
2851
} else {
@@ -2865,6 +2867,15 @@ func (c *ctxt9) asmout(p *obj.Prog, o *Optab, out []uint32) {
2865
2867
v = 0
2866
2868
}
2867
2869
2870
+ // Insert optional branch hint for bclr[l]/bcctr[l]
2871
+ if p .From3Type () != obj .TYPE_NONE {
2872
+ bh = uint32 (p .GetFrom3 ().Offset )
2873
+ if bh == 2 || bh > 3 {
2874
+ log .Fatalf ("BH must be 0,1,3 for %v" , p )
2875
+ }
2876
+ o1 |= bh << 11
2877
+ }
2878
+
2868
2879
if p .As == ABL || p .As == ABCL {
2869
2880
o1 |= 1
2870
2881
}
0 commit comments