1.1 --- a/src/cpu/x86/vm/x86_32.ad Mon May 11 18:30:13 2009 -0700 1.2 +++ b/src/cpu/x86/vm/x86_32.ad Wed May 13 00:45:22 2009 -0700 1.3 @@ -5240,6 +5240,15 @@ 1.4 interface(CONST_INTER); 1.5 %} 1.6 1.7 +// Constant for short-wide masking 1.8 +operand immI_65535() %{ 1.9 + predicate(n->get_int() == 65535); 1.10 + match(ConI); 1.11 + 1.12 + format %{ %} 1.13 + interface(CONST_INTER); 1.14 +%} 1.15 + 1.16 // Register Operands 1.17 // Integer Register 1.18 operand eRegI() %{ 1.19 @@ -6938,6 +6947,18 @@ 1.20 ins_pipe(ialu_reg_mem); 1.21 %} 1.22 1.23 +// Load Short (16 bit signed) to Byte (8 bit signed) 1.24 +instruct loadS2B(eRegI dst, memory mem, immI_24 twentyfour) %{ 1.25 + match(Set dst (RShiftI (LShiftI (LoadS mem) twentyfour) twentyfour)); 1.26 + 1.27 + ins_cost(125); 1.28 + format %{ "MOVSX $dst, $mem\t# short -> byte" %} 1.29 + ins_encode %{ 1.30 + __ movsbl($dst$$Register, $mem$$Address); 1.31 + %} 1.32 + ins_pipe(ialu_reg_mem); 1.33 +%} 1.34 + 1.35 // Load Short (16bit signed) into Long Register 1.36 instruct loadS2L(eRegL dst, memory mem) %{ 1.37 match(Set dst (ConvI2L (LoadS mem))); 1.38 @@ -6970,9 +6991,20 @@ 1.39 ins_pipe(ialu_reg_mem); 1.40 %} 1.41 1.42 +// Load Unsigned Short/Char (16 bit UNsigned) to Byte (8 bit signed) 1.43 +instruct loadUS2B(eRegI dst, memory mem, immI_24 twentyfour) %{ 1.44 + match(Set dst (RShiftI (LShiftI (LoadUS mem) twentyfour) twentyfour)); 1.45 + 1.46 + ins_cost(125); 1.47 + format %{ "MOVSX $dst, $mem\t# ushort -> byte" %} 1.48 + ins_encode %{ 1.49 + __ movsbl($dst$$Register, $mem$$Address); 1.50 + %} 1.51 + ins_pipe(ialu_reg_mem); 1.52 +%} 1.53 + 1.54 // Load Unsigned Short/Char (16 bit UNsigned) into Long Register 1.55 -instruct loadUS2L(eRegL dst, memory mem) 1.56 -%{ 1.57 +instruct loadUS2L(eRegL dst, memory mem) %{ 1.58 match(Set dst (ConvI2L (LoadUS mem))); 1.59 1.60 ins_cost(250); 1.61 @@ -7001,6 +7033,54 @@ 1.62 ins_pipe(ialu_reg_mem); 1.63 %} 1.64 1.65 +// Load Integer (32 bit signed) to Byte (8 bit signed) 1.66 +instruct loadI2B(eRegI dst, memory mem, immI_24 twentyfour) %{ 1.67 + match(Set dst (RShiftI (LShiftI (LoadI mem) twentyfour) twentyfour)); 1.68 + 1.69 + ins_cost(125); 1.70 + format %{ "MOVSX $dst, $mem\t# int -> byte" %} 1.71 + ins_encode %{ 1.72 + __ movsbl($dst$$Register, $mem$$Address); 1.73 + %} 1.74 + ins_pipe(ialu_reg_mem); 1.75 +%} 1.76 + 1.77 +// Load Integer (32 bit signed) to Unsigned Byte (8 bit UNsigned) 1.78 +instruct loadI2UB(eRegI dst, memory mem, immI_255 mask) %{ 1.79 + match(Set dst (AndI (LoadI mem) mask)); 1.80 + 1.81 + ins_cost(125); 1.82 + format %{ "MOVZX $dst, $mem\t# int -> ubyte" %} 1.83 + ins_encode %{ 1.84 + __ movzbl($dst$$Register, $mem$$Address); 1.85 + %} 1.86 + ins_pipe(ialu_reg_mem); 1.87 +%} 1.88 + 1.89 +// Load Integer (32 bit signed) to Short (16 bit signed) 1.90 +instruct loadI2S(eRegI dst, memory mem, immI_16 sixteen) %{ 1.91 + match(Set dst (RShiftI (LShiftI (LoadI mem) sixteen) sixteen)); 1.92 + 1.93 + ins_cost(125); 1.94 + format %{ "MOVSX $dst, $mem\t# int -> short" %} 1.95 + ins_encode %{ 1.96 + __ movswl($dst$$Register, $mem$$Address); 1.97 + %} 1.98 + ins_pipe(ialu_reg_mem); 1.99 +%} 1.100 + 1.101 +// Load Integer (32 bit signed) to Unsigned Short/Char (16 bit UNsigned) 1.102 +instruct loadI2US(eRegI dst, memory mem, immI_65535 mask) %{ 1.103 + match(Set dst (AndI (LoadI mem) mask)); 1.104 + 1.105 + ins_cost(125); 1.106 + format %{ "MOVZX $dst, $mem\t# int -> ushort/char" %} 1.107 + ins_encode %{ 1.108 + __ movzwl($dst$$Register, $mem$$Address); 1.109 + %} 1.110 + ins_pipe(ialu_reg_mem); 1.111 +%} 1.112 + 1.113 // Load Integer into Long Register 1.114 instruct loadI2L(eRegL dst, memory mem) %{ 1.115 match(Set dst (ConvI2L (LoadI mem))); 1.116 @@ -9034,28 +9114,28 @@ 1.117 1.118 // Logical Shift Right by 24, followed by Arithmetic Shift Left by 24. 1.119 // This idiom is used by the compiler for the i2b bytecode. 1.120 -instruct i2b(eRegI dst, xRegI src, immI_24 twentyfour, eFlagsReg cr) %{ 1.121 +instruct i2b(eRegI dst, xRegI src, immI_24 twentyfour) %{ 1.122 match(Set dst (RShiftI (LShiftI src twentyfour) twentyfour)); 1.123 - effect(KILL cr); 1.124 1.125 size(3); 1.126 format %{ "MOVSX $dst,$src :8" %} 1.127 - opcode(0xBE, 0x0F); 1.128 - ins_encode( OpcS, OpcP, RegReg( dst, src)); 1.129 - ins_pipe( ialu_reg_reg ); 1.130 + ins_encode %{ 1.131 + __ movsbl($dst$$Register, $src$$Register); 1.132 + %} 1.133 + ins_pipe(ialu_reg_reg); 1.134 %} 1.135 1.136 // Logical Shift Right by 16, followed by Arithmetic Shift Left by 16. 1.137 // This idiom is used by the compiler the i2s bytecode. 1.138 -instruct i2s(eRegI dst, xRegI src, immI_16 sixteen, eFlagsReg cr) %{ 1.139 +instruct i2s(eRegI dst, xRegI src, immI_16 sixteen) %{ 1.140 match(Set dst (RShiftI (LShiftI src sixteen) sixteen)); 1.141 - effect(KILL cr); 1.142 1.143 size(3); 1.144 format %{ "MOVSX $dst,$src :16" %} 1.145 - opcode(0xBF, 0x0F); 1.146 - ins_encode( OpcS, OpcP, RegReg( dst, src)); 1.147 - ins_pipe( ialu_reg_reg ); 1.148 + ins_encode %{ 1.149 + __ movswl($dst$$Register, $src$$Register); 1.150 + %} 1.151 + ins_pipe(ialu_reg_reg); 1.152 %} 1.153 1.154