Source file src/cmd/compile/internal/ssarewrite/rewriteppc64latelower/rewritePPC64latelower.go

     1  // Code generated from _gen/PPC64latelower.rules using 'go generate'; DO NOT EDIT.
     2  
     3  package rewriteppc64latelower
     4  
     5  import "internal/buildcfg"
     6  import "cmd/compile/internal/ssa/ssaop"
     7  import "cmd/compile/internal/ssa"
     8  
     9  func RewriteValue(v *ssa.Value) bool {
    10  	switch v.Op {
    11  	case ssaop.OpPPC64ADD:
    12  		return rewriteValue_OpPPC64ADD(v)
    13  	case ssaop.OpPPC64AND:
    14  		return rewriteValue_OpPPC64AND(v)
    15  	case ssaop.OpPPC64ANDconst:
    16  		return rewriteValue_OpPPC64ANDconst(v)
    17  	case ssaop.OpPPC64CMPconst:
    18  		return rewriteValue_OpPPC64CMPconst(v)
    19  	case ssaop.OpPPC64ISEL:
    20  		return rewriteValue_OpPPC64ISEL(v)
    21  	case ssaop.OpPPC64RLDICL:
    22  		return rewriteValue_OpPPC64RLDICL(v)
    23  	case ssaop.OpPPC64RLDICLCC:
    24  		return rewriteValue_OpPPC64RLDICLCC(v)
    25  	case ssaop.OpPPC64SETBC:
    26  		return rewriteValue_OpPPC64SETBC(v)
    27  	case ssaop.OpPPC64SETBCR:
    28  		return rewriteValue_OpPPC64SETBCR(v)
    29  	}
    30  	return false
    31  }
    32  func rewriteValue_OpPPC64ADD(v *ssa.Value) bool {
    33  	v_1 := v.Args[1]
    34  	v_0 := v.Args[0]
    35  	// match: (ADD (MOVDconst [m]) x)
    36  	// cond: ssa.SupportsPPC64PCRel() && (m<<30)>>30 == m
    37  	// result: (ADDconst [m] x)
    38  	for {
    39  		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
    40  			if v_0.Op != ssaop.OpPPC64MOVDconst {
    41  				continue
    42  			}
    43  			m := ssa.AuxIntToInt64(v_0.AuxInt)
    44  			x := v_1
    45  			if !(ssa.SupportsPPC64PCRel() && (m<<30)>>30 == m) {
    46  				continue
    47  			}
    48  			v.Reset(ssaop.OpPPC64ADDconst)
    49  			v.AuxInt = ssa.Int64ToAuxInt(m)
    50  			v.AddArg(x)
    51  			return true
    52  		}
    53  		break
    54  	}
    55  	return false
    56  }
    57  func rewriteValue_OpPPC64AND(v *ssa.Value) bool {
    58  	v_1 := v.Args[1]
    59  	v_0 := v.Args[0]
    60  	// match: (AND x:(MOVDconst [m]) n)
    61  	// cond: ssa.IsPPC64ValidShiftMask(m)
    62  	// result: (RLDICL [ssa.EncodePPC64RotateMask(0,m,64)] n)
    63  	for {
    64  		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
    65  			x := v_0
    66  			if x.Op != ssaop.OpPPC64MOVDconst {
    67  				continue
    68  			}
    69  			m := ssa.AuxIntToInt64(x.AuxInt)
    70  			n := v_1
    71  			if !(ssa.IsPPC64ValidShiftMask(m)) {
    72  				continue
    73  			}
    74  			v.Reset(ssaop.OpPPC64RLDICL)
    75  			v.AuxInt = ssa.Int64ToAuxInt(ssa.EncodePPC64RotateMask(0, m, 64))
    76  			v.AddArg(n)
    77  			return true
    78  		}
    79  		break
    80  	}
    81  	// match: (AND x:(MOVDconst [m]) n)
    82  	// cond: m != 0 && ssa.IsPPC64ValidShiftMask(^m)
    83  	// result: (RLDICR [ssa.EncodePPC64RotateMask(0,m,64)] n)
    84  	for {
    85  		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
    86  			x := v_0
    87  			if x.Op != ssaop.OpPPC64MOVDconst {
    88  				continue
    89  			}
    90  			m := ssa.AuxIntToInt64(x.AuxInt)
    91  			n := v_1
    92  			if !(m != 0 && ssa.IsPPC64ValidShiftMask(^m)) {
    93  				continue
    94  			}
    95  			v.Reset(ssaop.OpPPC64RLDICR)
    96  			v.AuxInt = ssa.Int64ToAuxInt(ssa.EncodePPC64RotateMask(0, m, 64))
    97  			v.AddArg(n)
    98  			return true
    99  		}
   100  		break
   101  	}
   102  	// match: (AND <t> x:(MOVDconst [m]) n)
   103  	// cond: t.Size() == 4 && ssa.IsPPC64WordRotateMask(m)
   104  	// result: (RLWINM [ssa.EncodePPC64RotateMask(0,m,32)] n)
   105  	for {
   106  		t := v.Type
   107  		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
   108  			x := v_0
   109  			if x.Op != ssaop.OpPPC64MOVDconst {
   110  				continue
   111  			}
   112  			m := ssa.AuxIntToInt64(x.AuxInt)
   113  			n := v_1
   114  			if !(t.Size() == 4 && ssa.IsPPC64WordRotateMask(m)) {
   115  				continue
   116  			}
   117  			v.Reset(ssaop.OpPPC64RLWINM)
   118  			v.AuxInt = ssa.Int64ToAuxInt(ssa.EncodePPC64RotateMask(0, m, 32))
   119  			v.AddArg(n)
   120  			return true
   121  		}
   122  		break
   123  	}
   124  	return false
   125  }
   126  func rewriteValue_OpPPC64ANDconst(v *ssa.Value) bool {
   127  	v_0 := v.Args[0]
   128  	// match: (ANDconst [m] x)
   129  	// cond: ssa.IsPPC64ValidShiftMask(m)
   130  	// result: (RLDICL [ssa.EncodePPC64RotateMask(0,m,64)] x)
   131  	for {
   132  		m := ssa.AuxIntToInt64(v.AuxInt)
   133  		x := v_0
   134  		if !(ssa.IsPPC64ValidShiftMask(m)) {
   135  			break
   136  		}
   137  		v.Reset(ssaop.OpPPC64RLDICL)
   138  		v.AuxInt = ssa.Int64ToAuxInt(ssa.EncodePPC64RotateMask(0, m, 64))
   139  		v.AddArg(x)
   140  		return true
   141  	}
   142  	return false
   143  }
   144  func rewriteValue_OpPPC64CMPconst(v *ssa.Value) bool {
   145  	v_0 := v.Args[0]
   146  	// match: (CMPconst [0] z:(ADD x y))
   147  	// cond: v.Block == z.Block
   148  	// result: (CMPconst [0] convertPPC64OpToOpCC(z))
   149  	for {
   150  		if ssa.AuxIntToInt64(v.AuxInt) != 0 {
   151  			break
   152  		}
   153  		z := v_0
   154  		if z.Op != ssaop.OpPPC64ADD {
   155  			break
   156  		}
   157  		if !(v.Block == z.Block) {
   158  			break
   159  		}
   160  		v.Reset(ssaop.OpPPC64CMPconst)
   161  		v.AuxInt = ssa.Int64ToAuxInt(0)
   162  		v.AddArg(convertPPC64OpToOpCC(z))
   163  		return true
   164  	}
   165  	// match: (CMPconst [0] z:(AND x y))
   166  	// cond: v.Block == z.Block
   167  	// result: (CMPconst [0] convertPPC64OpToOpCC(z))
   168  	for {
   169  		if ssa.AuxIntToInt64(v.AuxInt) != 0 {
   170  			break
   171  		}
   172  		z := v_0
   173  		if z.Op != ssaop.OpPPC64AND {
   174  			break
   175  		}
   176  		if !(v.Block == z.Block) {
   177  			break
   178  		}
   179  		v.Reset(ssaop.OpPPC64CMPconst)
   180  		v.AuxInt = ssa.Int64ToAuxInt(0)
   181  		v.AddArg(convertPPC64OpToOpCC(z))
   182  		return true
   183  	}
   184  	// match: (CMPconst [0] z:(ANDN x y))
   185  	// cond: v.Block == z.Block
   186  	// result: (CMPconst [0] convertPPC64OpToOpCC(z))
   187  	for {
   188  		if ssa.AuxIntToInt64(v.AuxInt) != 0 {
   189  			break
   190  		}
   191  		z := v_0
   192  		if z.Op != ssaop.OpPPC64ANDN {
   193  			break
   194  		}
   195  		if !(v.Block == z.Block) {
   196  			break
   197  		}
   198  		v.Reset(ssaop.OpPPC64CMPconst)
   199  		v.AuxInt = ssa.Int64ToAuxInt(0)
   200  		v.AddArg(convertPPC64OpToOpCC(z))
   201  		return true
   202  	}
   203  	// match: (CMPconst [0] z:(OR x y))
   204  	// cond: v.Block == z.Block
   205  	// result: (CMPconst [0] convertPPC64OpToOpCC(z))
   206  	for {
   207  		if ssa.AuxIntToInt64(v.AuxInt) != 0 {
   208  			break
   209  		}
   210  		z := v_0
   211  		if z.Op != ssaop.OpPPC64OR {
   212  			break
   213  		}
   214  		if !(v.Block == z.Block) {
   215  			break
   216  		}
   217  		v.Reset(ssaop.OpPPC64CMPconst)
   218  		v.AuxInt = ssa.Int64ToAuxInt(0)
   219  		v.AddArg(convertPPC64OpToOpCC(z))
   220  		return true
   221  	}
   222  	// match: (CMPconst [0] z:(SUB x y))
   223  	// cond: v.Block == z.Block
   224  	// result: (CMPconst [0] convertPPC64OpToOpCC(z))
   225  	for {
   226  		if ssa.AuxIntToInt64(v.AuxInt) != 0 {
   227  			break
   228  		}
   229  		z := v_0
   230  		if z.Op != ssaop.OpPPC64SUB {
   231  			break
   232  		}
   233  		if !(v.Block == z.Block) {
   234  			break
   235  		}
   236  		v.Reset(ssaop.OpPPC64CMPconst)
   237  		v.AuxInt = ssa.Int64ToAuxInt(0)
   238  		v.AddArg(convertPPC64OpToOpCC(z))
   239  		return true
   240  	}
   241  	// match: (CMPconst [0] z:(NOR x y))
   242  	// cond: v.Block == z.Block
   243  	// result: (CMPconst [0] convertPPC64OpToOpCC(z))
   244  	for {
   245  		if ssa.AuxIntToInt64(v.AuxInt) != 0 {
   246  			break
   247  		}
   248  		z := v_0
   249  		if z.Op != ssaop.OpPPC64NOR {
   250  			break
   251  		}
   252  		if !(v.Block == z.Block) {
   253  			break
   254  		}
   255  		v.Reset(ssaop.OpPPC64CMPconst)
   256  		v.AuxInt = ssa.Int64ToAuxInt(0)
   257  		v.AddArg(convertPPC64OpToOpCC(z))
   258  		return true
   259  	}
   260  	// match: (CMPconst [0] z:(XOR x y))
   261  	// cond: v.Block == z.Block
   262  	// result: (CMPconst [0] convertPPC64OpToOpCC(z))
   263  	for {
   264  		if ssa.AuxIntToInt64(v.AuxInt) != 0 {
   265  			break
   266  		}
   267  		z := v_0
   268  		if z.Op != ssaop.OpPPC64XOR {
   269  			break
   270  		}
   271  		if !(v.Block == z.Block) {
   272  			break
   273  		}
   274  		v.Reset(ssaop.OpPPC64CMPconst)
   275  		v.AuxInt = ssa.Int64ToAuxInt(0)
   276  		v.AddArg(convertPPC64OpToOpCC(z))
   277  		return true
   278  	}
   279  	// match: (CMPconst [0] z:(MULHDU x y))
   280  	// cond: v.Block == z.Block
   281  	// result: (CMPconst [0] convertPPC64OpToOpCC(z))
   282  	for {
   283  		if ssa.AuxIntToInt64(v.AuxInt) != 0 {
   284  			break
   285  		}
   286  		z := v_0
   287  		if z.Op != ssaop.OpPPC64MULHDU {
   288  			break
   289  		}
   290  		if !(v.Block == z.Block) {
   291  			break
   292  		}
   293  		v.Reset(ssaop.OpPPC64CMPconst)
   294  		v.AuxInt = ssa.Int64ToAuxInt(0)
   295  		v.AddArg(convertPPC64OpToOpCC(z))
   296  		return true
   297  	}
   298  	// match: (CMPconst [0] z:(NEG x))
   299  	// cond: v.Block == z.Block
   300  	// result: (CMPconst [0] convertPPC64OpToOpCC(z))
   301  	for {
   302  		if ssa.AuxIntToInt64(v.AuxInt) != 0 {
   303  			break
   304  		}
   305  		z := v_0
   306  		if z.Op != ssaop.OpPPC64NEG {
   307  			break
   308  		}
   309  		if !(v.Block == z.Block) {
   310  			break
   311  		}
   312  		v.Reset(ssaop.OpPPC64CMPconst)
   313  		v.AuxInt = ssa.Int64ToAuxInt(0)
   314  		v.AddArg(convertPPC64OpToOpCC(z))
   315  		return true
   316  	}
   317  	// match: (CMPconst [0] z:(CNTLZD x))
   318  	// cond: v.Block == z.Block
   319  	// result: (CMPconst [0] convertPPC64OpToOpCC(z))
   320  	for {
   321  		if ssa.AuxIntToInt64(v.AuxInt) != 0 {
   322  			break
   323  		}
   324  		z := v_0
   325  		if z.Op != ssaop.OpPPC64CNTLZD {
   326  			break
   327  		}
   328  		if !(v.Block == z.Block) {
   329  			break
   330  		}
   331  		v.Reset(ssaop.OpPPC64CMPconst)
   332  		v.AuxInt = ssa.Int64ToAuxInt(0)
   333  		v.AddArg(convertPPC64OpToOpCC(z))
   334  		return true
   335  	}
   336  	// match: (CMPconst [0] z:(RLDICL x))
   337  	// cond: v.Block == z.Block
   338  	// result: (CMPconst [0] convertPPC64OpToOpCC(z))
   339  	for {
   340  		if ssa.AuxIntToInt64(v.AuxInt) != 0 {
   341  			break
   342  		}
   343  		z := v_0
   344  		if z.Op != ssaop.OpPPC64RLDICL {
   345  			break
   346  		}
   347  		if !(v.Block == z.Block) {
   348  			break
   349  		}
   350  		v.Reset(ssaop.OpPPC64CMPconst)
   351  		v.AuxInt = ssa.Int64ToAuxInt(0)
   352  		v.AddArg(convertPPC64OpToOpCC(z))
   353  		return true
   354  	}
   355  	// match: (CMPconst [0] z:(ADDconst [c] x))
   356  	// cond: int64(int16(c)) == c && v.Block == z.Block
   357  	// result: (CMPconst [0] convertPPC64OpToOpCC(z))
   358  	for {
   359  		if ssa.AuxIntToInt64(v.AuxInt) != 0 {
   360  			break
   361  		}
   362  		z := v_0
   363  		if z.Op != ssaop.OpPPC64ADDconst {
   364  			break
   365  		}
   366  		c := ssa.AuxIntToInt64(z.AuxInt)
   367  		if !(int64(int16(c)) == c && v.Block == z.Block) {
   368  			break
   369  		}
   370  		v.Reset(ssaop.OpPPC64CMPconst)
   371  		v.AuxInt = ssa.Int64ToAuxInt(0)
   372  		v.AddArg(convertPPC64OpToOpCC(z))
   373  		return true
   374  	}
   375  	// match: (CMPconst [0] z:(ANDconst [c] x))
   376  	// cond: int64(uint16(c)) == c && v.Block == z.Block
   377  	// result: (CMPconst [0] convertPPC64OpToOpCC(z))
   378  	for {
   379  		if ssa.AuxIntToInt64(v.AuxInt) != 0 {
   380  			break
   381  		}
   382  		z := v_0
   383  		if z.Op != ssaop.OpPPC64ANDconst {
   384  			break
   385  		}
   386  		c := ssa.AuxIntToInt64(z.AuxInt)
   387  		if !(int64(uint16(c)) == c && v.Block == z.Block) {
   388  			break
   389  		}
   390  		v.Reset(ssaop.OpPPC64CMPconst)
   391  		v.AuxInt = ssa.Int64ToAuxInt(0)
   392  		v.AddArg(convertPPC64OpToOpCC(z))
   393  		return true
   394  	}
   395  	// match: (CMPconst <t> [0] (Select0 z:(ADDCC x y)))
   396  	// result: (Select1 <t> z)
   397  	for {
   398  		t := v.Type
   399  		if ssa.AuxIntToInt64(v.AuxInt) != 0 || v_0.Op != ssaop.OpSelect0 {
   400  			break
   401  		}
   402  		z := v_0.Args[0]
   403  		if z.Op != ssaop.OpPPC64ADDCC {
   404  			break
   405  		}
   406  		v.Reset(ssaop.OpSelect1)
   407  		v.Type = t
   408  		v.AddArg(z)
   409  		return true
   410  	}
   411  	// match: (CMPconst <t> [0] (Select0 z:(ANDCC x y)))
   412  	// result: (Select1 <t> z)
   413  	for {
   414  		t := v.Type
   415  		if ssa.AuxIntToInt64(v.AuxInt) != 0 || v_0.Op != ssaop.OpSelect0 {
   416  			break
   417  		}
   418  		z := v_0.Args[0]
   419  		if z.Op != ssaop.OpPPC64ANDCC {
   420  			break
   421  		}
   422  		v.Reset(ssaop.OpSelect1)
   423  		v.Type = t
   424  		v.AddArg(z)
   425  		return true
   426  	}
   427  	// match: (CMPconst <t> [0] (Select0 z:(ANDNCC x y)))
   428  	// result: (Select1 <t> z)
   429  	for {
   430  		t := v.Type
   431  		if ssa.AuxIntToInt64(v.AuxInt) != 0 || v_0.Op != ssaop.OpSelect0 {
   432  			break
   433  		}
   434  		z := v_0.Args[0]
   435  		if z.Op != ssaop.OpPPC64ANDNCC {
   436  			break
   437  		}
   438  		v.Reset(ssaop.OpSelect1)
   439  		v.Type = t
   440  		v.AddArg(z)
   441  		return true
   442  	}
   443  	// match: (CMPconst <t> [0] (Select0 z:(ORCC x y)))
   444  	// result: (Select1 <t> z)
   445  	for {
   446  		t := v.Type
   447  		if ssa.AuxIntToInt64(v.AuxInt) != 0 || v_0.Op != ssaop.OpSelect0 {
   448  			break
   449  		}
   450  		z := v_0.Args[0]
   451  		if z.Op != ssaop.OpPPC64ORCC {
   452  			break
   453  		}
   454  		v.Reset(ssaop.OpSelect1)
   455  		v.Type = t
   456  		v.AddArg(z)
   457  		return true
   458  	}
   459  	// match: (CMPconst <t> [0] (Select0 z:(SUBCC x y)))
   460  	// result: (Select1 <t> z)
   461  	for {
   462  		t := v.Type
   463  		if ssa.AuxIntToInt64(v.AuxInt) != 0 || v_0.Op != ssaop.OpSelect0 {
   464  			break
   465  		}
   466  		z := v_0.Args[0]
   467  		if z.Op != ssaop.OpPPC64SUBCC {
   468  			break
   469  		}
   470  		v.Reset(ssaop.OpSelect1)
   471  		v.Type = t
   472  		v.AddArg(z)
   473  		return true
   474  	}
   475  	// match: (CMPconst <t> [0] (Select0 z:(NORCC x y)))
   476  	// result: (Select1 <t> z)
   477  	for {
   478  		t := v.Type
   479  		if ssa.AuxIntToInt64(v.AuxInt) != 0 || v_0.Op != ssaop.OpSelect0 {
   480  			break
   481  		}
   482  		z := v_0.Args[0]
   483  		if z.Op != ssaop.OpPPC64NORCC {
   484  			break
   485  		}
   486  		v.Reset(ssaop.OpSelect1)
   487  		v.Type = t
   488  		v.AddArg(z)
   489  		return true
   490  	}
   491  	// match: (CMPconst <t> [0] (Select0 z:(XORCC x y)))
   492  	// result: (Select1 <t> z)
   493  	for {
   494  		t := v.Type
   495  		if ssa.AuxIntToInt64(v.AuxInt) != 0 || v_0.Op != ssaop.OpSelect0 {
   496  			break
   497  		}
   498  		z := v_0.Args[0]
   499  		if z.Op != ssaop.OpPPC64XORCC {
   500  			break
   501  		}
   502  		v.Reset(ssaop.OpSelect1)
   503  		v.Type = t
   504  		v.AddArg(z)
   505  		return true
   506  	}
   507  	// match: (CMPconst <t> [0] (Select0 z:(MULHDUCC x y)))
   508  	// result: (Select1 <t> z)
   509  	for {
   510  		t := v.Type
   511  		if ssa.AuxIntToInt64(v.AuxInt) != 0 || v_0.Op != ssaop.OpSelect0 {
   512  			break
   513  		}
   514  		z := v_0.Args[0]
   515  		if z.Op != ssaop.OpPPC64MULHDUCC {
   516  			break
   517  		}
   518  		v.Reset(ssaop.OpSelect1)
   519  		v.Type = t
   520  		v.AddArg(z)
   521  		return true
   522  	}
   523  	// match: (CMPconst <t> [0] (Select0 z:(ADDCCconst y)))
   524  	// result: (Select1 <t> z)
   525  	for {
   526  		t := v.Type
   527  		if ssa.AuxIntToInt64(v.AuxInt) != 0 || v_0.Op != ssaop.OpSelect0 {
   528  			break
   529  		}
   530  		z := v_0.Args[0]
   531  		if z.Op != ssaop.OpPPC64ADDCCconst {
   532  			break
   533  		}
   534  		v.Reset(ssaop.OpSelect1)
   535  		v.Type = t
   536  		v.AddArg(z)
   537  		return true
   538  	}
   539  	// match: (CMPconst <t> [0] (Select0 z:(ANDCCconst y)))
   540  	// result: (Select1 <t> z)
   541  	for {
   542  		t := v.Type
   543  		if ssa.AuxIntToInt64(v.AuxInt) != 0 || v_0.Op != ssaop.OpSelect0 {
   544  			break
   545  		}
   546  		z := v_0.Args[0]
   547  		if z.Op != ssaop.OpPPC64ANDCCconst {
   548  			break
   549  		}
   550  		v.Reset(ssaop.OpSelect1)
   551  		v.Type = t
   552  		v.AddArg(z)
   553  		return true
   554  	}
   555  	// match: (CMPconst <t> [0] (Select0 z:(NEGCC y)))
   556  	// result: (Select1 <t> z)
   557  	for {
   558  		t := v.Type
   559  		if ssa.AuxIntToInt64(v.AuxInt) != 0 || v_0.Op != ssaop.OpSelect0 {
   560  			break
   561  		}
   562  		z := v_0.Args[0]
   563  		if z.Op != ssaop.OpPPC64NEGCC {
   564  			break
   565  		}
   566  		v.Reset(ssaop.OpSelect1)
   567  		v.Type = t
   568  		v.AddArg(z)
   569  		return true
   570  	}
   571  	// match: (CMPconst <t> [0] (Select0 z:(CNTLZDCC y)))
   572  	// result: (Select1 <t> z)
   573  	for {
   574  		t := v.Type
   575  		if ssa.AuxIntToInt64(v.AuxInt) != 0 || v_0.Op != ssaop.OpSelect0 {
   576  			break
   577  		}
   578  		z := v_0.Args[0]
   579  		if z.Op != ssaop.OpPPC64CNTLZDCC {
   580  			break
   581  		}
   582  		v.Reset(ssaop.OpSelect1)
   583  		v.Type = t
   584  		v.AddArg(z)
   585  		return true
   586  	}
   587  	// match: (CMPconst <t> [0] (Select0 z:(RLDICLCC y)))
   588  	// result: (Select1 <t> z)
   589  	for {
   590  		t := v.Type
   591  		if ssa.AuxIntToInt64(v.AuxInt) != 0 || v_0.Op != ssaop.OpSelect0 {
   592  			break
   593  		}
   594  		z := v_0.Args[0]
   595  		if z.Op != ssaop.OpPPC64RLDICLCC {
   596  			break
   597  		}
   598  		v.Reset(ssaop.OpSelect1)
   599  		v.Type = t
   600  		v.AddArg(z)
   601  		return true
   602  	}
   603  	return false
   604  }
   605  func rewriteValue_OpPPC64ISEL(v *ssa.Value) bool {
   606  	v_2 := v.Args[2]
   607  	v_1 := v.Args[1]
   608  	v_0 := v.Args[0]
   609  	// match: (ISEL [a] x (MOVDconst [0]) z)
   610  	// result: (ISELZ [a] x z)
   611  	for {
   612  		a := ssa.AuxIntToInt32(v.AuxInt)
   613  		x := v_0
   614  		if v_1.Op != ssaop.OpPPC64MOVDconst || ssa.AuxIntToInt64(v_1.AuxInt) != 0 {
   615  			break
   616  		}
   617  		z := v_2
   618  		v.Reset(ssaop.OpPPC64ISELZ)
   619  		v.AuxInt = ssa.Int32ToAuxInt(a)
   620  		v.AddArg2(x, z)
   621  		return true
   622  	}
   623  	// match: (ISEL [a] (MOVDconst [0]) y z)
   624  	// result: (ISELZ [a^0x4] y z)
   625  	for {
   626  		a := ssa.AuxIntToInt32(v.AuxInt)
   627  		if v_0.Op != ssaop.OpPPC64MOVDconst || ssa.AuxIntToInt64(v_0.AuxInt) != 0 {
   628  			break
   629  		}
   630  		y := v_1
   631  		z := v_2
   632  		v.Reset(ssaop.OpPPC64ISELZ)
   633  		v.AuxInt = ssa.Int32ToAuxInt(a ^ 0x4)
   634  		v.AddArg2(y, z)
   635  		return true
   636  	}
   637  	return false
   638  }
   639  func rewriteValue_OpPPC64RLDICL(v *ssa.Value) bool {
   640  	v_0 := v.Args[0]
   641  	// match: (RLDICL [em] x:(SRDconst [s] a))
   642  	// cond: (em&0xFF0000) == 0
   643  	// result: (RLDICL [mergePPC64RLDICLandSRDconst(em, s)] a)
   644  	for {
   645  		em := ssa.AuxIntToInt64(v.AuxInt)
   646  		x := v_0
   647  		if x.Op != ssaop.OpPPC64SRDconst {
   648  			break
   649  		}
   650  		s := ssa.AuxIntToInt64(x.AuxInt)
   651  		a := x.Args[0]
   652  		if !((em & 0xFF0000) == 0) {
   653  			break
   654  		}
   655  		v.Reset(ssaop.OpPPC64RLDICL)
   656  		v.AuxInt = ssa.Int64ToAuxInt(mergePPC64RLDICLandSRDconst(em, s))
   657  		v.AddArg(a)
   658  		return true
   659  	}
   660  	return false
   661  }
   662  func rewriteValue_OpPPC64RLDICLCC(v *ssa.Value) bool {
   663  	v_0 := v.Args[0]
   664  	// match: (RLDICLCC [a] x)
   665  	// cond: convertPPC64RldiclAndccconst(a) != 0
   666  	// result: (ANDCCconst [convertPPC64RldiclAndccconst(a)] x)
   667  	for {
   668  		a := ssa.AuxIntToInt64(v.AuxInt)
   669  		x := v_0
   670  		if !(convertPPC64RldiclAndccconst(a) != 0) {
   671  			break
   672  		}
   673  		v.Reset(ssaop.OpPPC64ANDCCconst)
   674  		v.AuxInt = ssa.Int64ToAuxInt(convertPPC64RldiclAndccconst(a))
   675  		v.AddArg(x)
   676  		return true
   677  	}
   678  	return false
   679  }
   680  func rewriteValue_OpPPC64SETBC(v *ssa.Value) bool {
   681  	v_0 := v.Args[0]
   682  	b := v.Block
   683  	typ := &b.Func.Config.Types
   684  	// match: (SETBC [2] cmp)
   685  	// cond: buildcfg.GOPPC64 <= 9
   686  	// result: (ISELZ [2] (MOVDconst [1]) cmp)
   687  	for {
   688  		if ssa.AuxIntToInt32(v.AuxInt) != 2 {
   689  			break
   690  		}
   691  		cmp := v_0
   692  		if !(buildcfg.GOPPC64 <= 9) {
   693  			break
   694  		}
   695  		v.Reset(ssaop.OpPPC64ISELZ)
   696  		v.AuxInt = ssa.Int32ToAuxInt(2)
   697  		v0 := b.NewValue0(v.Pos, ssaop.OpPPC64MOVDconst, typ.Int64)
   698  		v0.AuxInt = ssa.Int64ToAuxInt(1)
   699  		v.AddArg2(v0, cmp)
   700  		return true
   701  	}
   702  	// match: (SETBC [0] cmp)
   703  	// cond: buildcfg.GOPPC64 <= 9
   704  	// result: (ISELZ [0] (MOVDconst [1]) cmp)
   705  	for {
   706  		if ssa.AuxIntToInt32(v.AuxInt) != 0 {
   707  			break
   708  		}
   709  		cmp := v_0
   710  		if !(buildcfg.GOPPC64 <= 9) {
   711  			break
   712  		}
   713  		v.Reset(ssaop.OpPPC64ISELZ)
   714  		v.AuxInt = ssa.Int32ToAuxInt(0)
   715  		v0 := b.NewValue0(v.Pos, ssaop.OpPPC64MOVDconst, typ.Int64)
   716  		v0.AuxInt = ssa.Int64ToAuxInt(1)
   717  		v.AddArg2(v0, cmp)
   718  		return true
   719  	}
   720  	// match: (SETBC [1] cmp)
   721  	// cond: buildcfg.GOPPC64 <= 9
   722  	// result: (ISELZ [1] (MOVDconst [1]) cmp)
   723  	for {
   724  		if ssa.AuxIntToInt32(v.AuxInt) != 1 {
   725  			break
   726  		}
   727  		cmp := v_0
   728  		if !(buildcfg.GOPPC64 <= 9) {
   729  			break
   730  		}
   731  		v.Reset(ssaop.OpPPC64ISELZ)
   732  		v.AuxInt = ssa.Int32ToAuxInt(1)
   733  		v0 := b.NewValue0(v.Pos, ssaop.OpPPC64MOVDconst, typ.Int64)
   734  		v0.AuxInt = ssa.Int64ToAuxInt(1)
   735  		v.AddArg2(v0, cmp)
   736  		return true
   737  	}
   738  	return false
   739  }
   740  func rewriteValue_OpPPC64SETBCR(v *ssa.Value) bool {
   741  	v_0 := v.Args[0]
   742  	b := v.Block
   743  	typ := &b.Func.Config.Types
   744  	// match: (SETBCR [2] cmp)
   745  	// cond: buildcfg.GOPPC64 <= 9
   746  	// result: (ISELZ [6] (MOVDconst [1]) cmp)
   747  	for {
   748  		if ssa.AuxIntToInt32(v.AuxInt) != 2 {
   749  			break
   750  		}
   751  		cmp := v_0
   752  		if !(buildcfg.GOPPC64 <= 9) {
   753  			break
   754  		}
   755  		v.Reset(ssaop.OpPPC64ISELZ)
   756  		v.AuxInt = ssa.Int32ToAuxInt(6)
   757  		v0 := b.NewValue0(v.Pos, ssaop.OpPPC64MOVDconst, typ.Int64)
   758  		v0.AuxInt = ssa.Int64ToAuxInt(1)
   759  		v.AddArg2(v0, cmp)
   760  		return true
   761  	}
   762  	// match: (SETBCR [0] cmp)
   763  	// cond: buildcfg.GOPPC64 <= 9
   764  	// result: (ISELZ [4] (MOVDconst [1]) cmp)
   765  	for {
   766  		if ssa.AuxIntToInt32(v.AuxInt) != 0 {
   767  			break
   768  		}
   769  		cmp := v_0
   770  		if !(buildcfg.GOPPC64 <= 9) {
   771  			break
   772  		}
   773  		v.Reset(ssaop.OpPPC64ISELZ)
   774  		v.AuxInt = ssa.Int32ToAuxInt(4)
   775  		v0 := b.NewValue0(v.Pos, ssaop.OpPPC64MOVDconst, typ.Int64)
   776  		v0.AuxInt = ssa.Int64ToAuxInt(1)
   777  		v.AddArg2(v0, cmp)
   778  		return true
   779  	}
   780  	// match: (SETBCR [1] cmp)
   781  	// cond: buildcfg.GOPPC64 <= 9
   782  	// result: (ISELZ [5] (MOVDconst [1]) cmp)
   783  	for {
   784  		if ssa.AuxIntToInt32(v.AuxInt) != 1 {
   785  			break
   786  		}
   787  		cmp := v_0
   788  		if !(buildcfg.GOPPC64 <= 9) {
   789  			break
   790  		}
   791  		v.Reset(ssaop.OpPPC64ISELZ)
   792  		v.AuxInt = ssa.Int32ToAuxInt(5)
   793  		v0 := b.NewValue0(v.Pos, ssaop.OpPPC64MOVDconst, typ.Int64)
   794  		v0.AuxInt = ssa.Int64ToAuxInt(1)
   795  		v.AddArg2(v0, cmp)
   796  		return true
   797  	}
   798  	return false
   799  }
   800  func RewriteBlock(b *ssa.Block) bool {
   801  	return false
   802  }
   803  

View as plain text