github.com/bir3/gocompiler@v0.9.2202/src/cmd/compile/internal/ssa/rewriteARM64latelower.go (about)

     1  // Code generated from _gen/ARM64latelower.rules using 'go generate'; DO NOT EDIT.
     2  
     3  package ssa
     4  
     5  func rewriteValueARM64latelower(v *Value) bool {
     6  	switch v.Op {
     7  	case OpARM64ADDSconstflags:
     8  		return rewriteValueARM64latelower_OpARM64ADDSconstflags(v)
     9  	case OpARM64ADDconst:
    10  		return rewriteValueARM64latelower_OpARM64ADDconst(v)
    11  	case OpARM64ANDconst:
    12  		return rewriteValueARM64latelower_OpARM64ANDconst(v)
    13  	case OpARM64CMNWconst:
    14  		return rewriteValueARM64latelower_OpARM64CMNWconst(v)
    15  	case OpARM64CMNconst:
    16  		return rewriteValueARM64latelower_OpARM64CMNconst(v)
    17  	case OpARM64CMPWconst:
    18  		return rewriteValueARM64latelower_OpARM64CMPWconst(v)
    19  	case OpARM64CMPconst:
    20  		return rewriteValueARM64latelower_OpARM64CMPconst(v)
    21  	case OpARM64ORconst:
    22  		return rewriteValueARM64latelower_OpARM64ORconst(v)
    23  	case OpARM64SUBconst:
    24  		return rewriteValueARM64latelower_OpARM64SUBconst(v)
    25  	case OpARM64TSTWconst:
    26  		return rewriteValueARM64latelower_OpARM64TSTWconst(v)
    27  	case OpARM64TSTconst:
    28  		return rewriteValueARM64latelower_OpARM64TSTconst(v)
    29  	case OpARM64XORconst:
    30  		return rewriteValueARM64latelower_OpARM64XORconst(v)
    31  	}
    32  	return false
    33  }
    34  func rewriteValueARM64latelower_OpARM64ADDSconstflags(v *Value) bool {
    35  	v_0 := v.Args[0]
    36  	b := v.Block
    37  	typ := &b.Func.Config.Types
    38  	// match: (ADDSconstflags [c] x)
    39  	// cond: !isARM64addcon(c)
    40  	// result: (ADDSflags x (MOVDconst [c]))
    41  	for {
    42  		c := auxIntToInt64(v.AuxInt)
    43  		x := v_0
    44  		if !(!isARM64addcon(c)) {
    45  			break
    46  		}
    47  		v.reset(OpARM64ADDSflags)
    48  		v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
    49  		v0.AuxInt = int64ToAuxInt(c)
    50  		v.AddArg2(x, v0)
    51  		return true
    52  	}
    53  	return false
    54  }
    55  func rewriteValueARM64latelower_OpARM64ADDconst(v *Value) bool {
    56  	v_0 := v.Args[0]
    57  	b := v.Block
    58  	typ := &b.Func.Config.Types
    59  	// match: (ADDconst [c] x)
    60  	// cond: !isARM64addcon(c)
    61  	// result: (ADD x (MOVDconst [c]))
    62  	for {
    63  		c := auxIntToInt64(v.AuxInt)
    64  		x := v_0
    65  		if !(!isARM64addcon(c)) {
    66  			break
    67  		}
    68  		v.reset(OpARM64ADD)
    69  		v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
    70  		v0.AuxInt = int64ToAuxInt(c)
    71  		v.AddArg2(x, v0)
    72  		return true
    73  	}
    74  	return false
    75  }
    76  func rewriteValueARM64latelower_OpARM64ANDconst(v *Value) bool {
    77  	v_0 := v.Args[0]
    78  	b := v.Block
    79  	typ := &b.Func.Config.Types
    80  	// match: (ANDconst [c] x)
    81  	// cond: !isARM64bitcon(uint64(c))
    82  	// result: (AND x (MOVDconst [c]))
    83  	for {
    84  		c := auxIntToInt64(v.AuxInt)
    85  		x := v_0
    86  		if !(!isARM64bitcon(uint64(c))) {
    87  			break
    88  		}
    89  		v.reset(OpARM64AND)
    90  		v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
    91  		v0.AuxInt = int64ToAuxInt(c)
    92  		v.AddArg2(x, v0)
    93  		return true
    94  	}
    95  	return false
    96  }
    97  func rewriteValueARM64latelower_OpARM64CMNWconst(v *Value) bool {
    98  	v_0 := v.Args[0]
    99  	b := v.Block
   100  	typ := &b.Func.Config.Types
   101  	// match: (CMNWconst [c] x)
   102  	// cond: !isARM64addcon(int64(c))
   103  	// result: (CMNW x (MOVDconst [int64(c)]))
   104  	for {
   105  		c := auxIntToInt32(v.AuxInt)
   106  		x := v_0
   107  		if !(!isARM64addcon(int64(c))) {
   108  			break
   109  		}
   110  		v.reset(OpARM64CMNW)
   111  		v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
   112  		v0.AuxInt = int64ToAuxInt(int64(c))
   113  		v.AddArg2(x, v0)
   114  		return true
   115  	}
   116  	return false
   117  }
   118  func rewriteValueARM64latelower_OpARM64CMNconst(v *Value) bool {
   119  	v_0 := v.Args[0]
   120  	b := v.Block
   121  	typ := &b.Func.Config.Types
   122  	// match: (CMNconst [c] x)
   123  	// cond: !isARM64addcon(c)
   124  	// result: (CMN x (MOVDconst [c]))
   125  	for {
   126  		c := auxIntToInt64(v.AuxInt)
   127  		x := v_0
   128  		if !(!isARM64addcon(c)) {
   129  			break
   130  		}
   131  		v.reset(OpARM64CMN)
   132  		v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
   133  		v0.AuxInt = int64ToAuxInt(c)
   134  		v.AddArg2(x, v0)
   135  		return true
   136  	}
   137  	return false
   138  }
   139  func rewriteValueARM64latelower_OpARM64CMPWconst(v *Value) bool {
   140  	v_0 := v.Args[0]
   141  	b := v.Block
   142  	typ := &b.Func.Config.Types
   143  	// match: (CMPWconst [c] x)
   144  	// cond: !isARM64addcon(int64(c))
   145  	// result: (CMPW x (MOVDconst [int64(c)]))
   146  	for {
   147  		c := auxIntToInt32(v.AuxInt)
   148  		x := v_0
   149  		if !(!isARM64addcon(int64(c))) {
   150  			break
   151  		}
   152  		v.reset(OpARM64CMPW)
   153  		v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
   154  		v0.AuxInt = int64ToAuxInt(int64(c))
   155  		v.AddArg2(x, v0)
   156  		return true
   157  	}
   158  	return false
   159  }
   160  func rewriteValueARM64latelower_OpARM64CMPconst(v *Value) bool {
   161  	v_0 := v.Args[0]
   162  	b := v.Block
   163  	typ := &b.Func.Config.Types
   164  	// match: (CMPconst [c] x)
   165  	// cond: !isARM64addcon(c)
   166  	// result: (CMP x (MOVDconst [c]))
   167  	for {
   168  		c := auxIntToInt64(v.AuxInt)
   169  		x := v_0
   170  		if !(!isARM64addcon(c)) {
   171  			break
   172  		}
   173  		v.reset(OpARM64CMP)
   174  		v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
   175  		v0.AuxInt = int64ToAuxInt(c)
   176  		v.AddArg2(x, v0)
   177  		return true
   178  	}
   179  	return false
   180  }
   181  func rewriteValueARM64latelower_OpARM64ORconst(v *Value) bool {
   182  	v_0 := v.Args[0]
   183  	b := v.Block
   184  	typ := &b.Func.Config.Types
   185  	// match: (ORconst [c] x)
   186  	// cond: !isARM64bitcon(uint64(c))
   187  	// result: (OR x (MOVDconst [c]))
   188  	for {
   189  		c := auxIntToInt64(v.AuxInt)
   190  		x := v_0
   191  		if !(!isARM64bitcon(uint64(c))) {
   192  			break
   193  		}
   194  		v.reset(OpARM64OR)
   195  		v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
   196  		v0.AuxInt = int64ToAuxInt(c)
   197  		v.AddArg2(x, v0)
   198  		return true
   199  	}
   200  	return false
   201  }
   202  func rewriteValueARM64latelower_OpARM64SUBconst(v *Value) bool {
   203  	v_0 := v.Args[0]
   204  	b := v.Block
   205  	typ := &b.Func.Config.Types
   206  	// match: (SUBconst [c] x)
   207  	// cond: !isARM64addcon(c)
   208  	// result: (SUB x (MOVDconst [c]))
   209  	for {
   210  		c := auxIntToInt64(v.AuxInt)
   211  		x := v_0
   212  		if !(!isARM64addcon(c)) {
   213  			break
   214  		}
   215  		v.reset(OpARM64SUB)
   216  		v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
   217  		v0.AuxInt = int64ToAuxInt(c)
   218  		v.AddArg2(x, v0)
   219  		return true
   220  	}
   221  	return false
   222  }
   223  func rewriteValueARM64latelower_OpARM64TSTWconst(v *Value) bool {
   224  	v_0 := v.Args[0]
   225  	b := v.Block
   226  	typ := &b.Func.Config.Types
   227  	// match: (TSTWconst [c] x)
   228  	// cond: !isARM64bitcon(uint64(c)|uint64(c)<<32)
   229  	// result: (TSTW x (MOVDconst [int64(c)]))
   230  	for {
   231  		c := auxIntToInt32(v.AuxInt)
   232  		x := v_0
   233  		if !(!isARM64bitcon(uint64(c) | uint64(c)<<32)) {
   234  			break
   235  		}
   236  		v.reset(OpARM64TSTW)
   237  		v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
   238  		v0.AuxInt = int64ToAuxInt(int64(c))
   239  		v.AddArg2(x, v0)
   240  		return true
   241  	}
   242  	return false
   243  }
   244  func rewriteValueARM64latelower_OpARM64TSTconst(v *Value) bool {
   245  	v_0 := v.Args[0]
   246  	b := v.Block
   247  	typ := &b.Func.Config.Types
   248  	// match: (TSTconst [c] x)
   249  	// cond: !isARM64bitcon(uint64(c))
   250  	// result: (TST x (MOVDconst [c]))
   251  	for {
   252  		c := auxIntToInt64(v.AuxInt)
   253  		x := v_0
   254  		if !(!isARM64bitcon(uint64(c))) {
   255  			break
   256  		}
   257  		v.reset(OpARM64TST)
   258  		v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
   259  		v0.AuxInt = int64ToAuxInt(c)
   260  		v.AddArg2(x, v0)
   261  		return true
   262  	}
   263  	return false
   264  }
   265  func rewriteValueARM64latelower_OpARM64XORconst(v *Value) bool {
   266  	v_0 := v.Args[0]
   267  	b := v.Block
   268  	typ := &b.Func.Config.Types
   269  	// match: (XORconst [c] x)
   270  	// cond: !isARM64bitcon(uint64(c))
   271  	// result: (XOR x (MOVDconst [c]))
   272  	for {
   273  		c := auxIntToInt64(v.AuxInt)
   274  		x := v_0
   275  		if !(!isARM64bitcon(uint64(c))) {
   276  			break
   277  		}
   278  		v.reset(OpARM64XOR)
   279  		v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
   280  		v0.AuxInt = int64ToAuxInt(c)
   281  		v.AddArg2(x, v0)
   282  		return true
   283  	}
   284  	return false
   285  }
   286  func rewriteBlockARM64latelower(b *Block) bool {
   287  	return false
   288  }