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

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