Source file src/cmd/compile/internal/ssarewrite/rewriteloong64latelower/rewriteLOONG64latelower.go

     1  // Code generated from _gen/LOONG64latelower.rules using 'go generate'; DO NOT EDIT.
     2  
     3  package rewriteloong64latelower
     4  
     5  import "cmd/compile/internal/ssa/block"
     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.OpLOONG64MOVBUreg:
    12  		return rewriteValue_OpLOONG64MOVBUreg(v)
    13  	case ssaop.OpLOONG64MOVHUreg:
    14  		return rewriteValue_OpLOONG64MOVHUreg(v)
    15  	case ssaop.OpLOONG64MOVVconst:
    16  		return rewriteValue_OpLOONG64MOVVconst(v)
    17  	case ssaop.OpLOONG64MOVWUreg:
    18  		return rewriteValue_OpLOONG64MOVWUreg(v)
    19  	case ssaop.OpLOONG64SLLVconst:
    20  		return rewriteValue_OpLOONG64SLLVconst(v)
    21  	}
    22  	return false
    23  }
    24  func rewriteValue_OpLOONG64MOVBUreg(v *ssa.Value) bool {
    25  	v_0 := v.Args[0]
    26  	// match: (MOVBUreg x)
    27  	// cond: ssa.ZeroUpper56Bits(x)
    28  	// result: x
    29  	for {
    30  		x := v_0
    31  		if !(ssa.ZeroUpper56Bits(x)) {
    32  			break
    33  		}
    34  		v.CopyOf(x)
    35  		return true
    36  	}
    37  	return false
    38  }
    39  func rewriteValue_OpLOONG64MOVHUreg(v *ssa.Value) bool {
    40  	v_0 := v.Args[0]
    41  	// match: (MOVHUreg x)
    42  	// cond: ssa.ZeroUpper48Bits(x)
    43  	// result: x
    44  	for {
    45  		x := v_0
    46  		if !(ssa.ZeroUpper48Bits(x)) {
    47  			break
    48  		}
    49  		v.CopyOf(x)
    50  		return true
    51  	}
    52  	return false
    53  }
    54  func rewriteValue_OpLOONG64MOVVconst(v *ssa.Value) bool {
    55  	// match: (MOVVconst [0])
    56  	// result: (ZERO)
    57  	for {
    58  		if ssa.AuxIntToInt64(v.AuxInt) != 0 {
    59  			break
    60  		}
    61  		v.Reset(ssaop.OpLOONG64ZERO)
    62  		return true
    63  	}
    64  	return false
    65  }
    66  func rewriteValue_OpLOONG64MOVWUreg(v *ssa.Value) bool {
    67  	v_0 := v.Args[0]
    68  	// match: (MOVWUreg x)
    69  	// cond: ssa.ZeroUpper32Bits(x)
    70  	// result: x
    71  	for {
    72  		x := v_0
    73  		if !(ssa.ZeroUpper32Bits(x)) {
    74  			break
    75  		}
    76  		v.CopyOf(x)
    77  		return true
    78  	}
    79  	return false
    80  }
    81  func rewriteValue_OpLOONG64SLLVconst(v *ssa.Value) bool {
    82  	v_0 := v.Args[0]
    83  	// match: (SLLVconst [1] x)
    84  	// result: (ADDV x x)
    85  	for {
    86  		if ssa.AuxIntToInt64(v.AuxInt) != 1 {
    87  			break
    88  		}
    89  		x := v_0
    90  		v.Reset(ssaop.OpLOONG64ADDV)
    91  		v.AddArg2(x, x)
    92  		return true
    93  	}
    94  	return false
    95  }
    96  func RewriteBlock(b *ssa.Block) bool {
    97  	switch b.Kind {
    98  	case block.BlockLOONG64EQZ:
    99  		// match: (EQZ (XOR x y) yes no)
   100  		// result: (BEQ x y yes no)
   101  		for b.Controls[0].Op == ssaop.OpLOONG64XOR {
   102  			v_0 := b.Controls[0]
   103  			_ = v_0.Args[1]
   104  			v_0_0 := v_0.Args[0]
   105  			v_0_1 := v_0.Args[1]
   106  			for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
   107  				x := v_0_0
   108  				y := v_0_1
   109  				b.ResetWithControl2(block.BlockLOONG64BEQ, x, y)
   110  				return true
   111  			}
   112  		}
   113  	case block.BlockLOONG64NEZ:
   114  		// match: (NEZ (XOR x y) yes no)
   115  		// result: (BNE x y yes no)
   116  		for b.Controls[0].Op == ssaop.OpLOONG64XOR {
   117  			v_0 := b.Controls[0]
   118  			_ = v_0.Args[1]
   119  			v_0_0 := v_0.Args[0]
   120  			v_0_1 := v_0.Args[1]
   121  			for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
   122  				x := v_0_0
   123  				y := v_0_1
   124  				b.ResetWithControl2(block.BlockLOONG64BNE, x, y)
   125  				return true
   126  			}
   127  		}
   128  	}
   129  	return false
   130  }
   131  

View as plain text