<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>


<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
Hi,<br><br>I am trying to take 16 bit memory reads and combine them to a single 32 bit read. I am having trouble to make the code simply read 32 bytes and the use the subregisters accordingly, without unnecessary copying.<br><br>I have tried two techniques, in the MachineFunction:<br><br>1. replace the MachineOperands in the users of the data with the new register/subregister index. This yields an assert failure during VirtRegRewriter, in substPhysReg: "Invalid SubReg for physical register", after the Two-address rewrote this:<br><br>%reg16445<def> = add %reg16507:hi16, %reg16510:hi16 ; 32bit:16507,16510, 16bit: 16445  <br>  prepend:    %reg16445<def> = COPY %reg16507; <br>  rewrite to:    %reg16445<def> = addh_1_8 <u><b>%reg16445:hi16</b></u>, %reg16510:hi16<br><br>In my eyes, there should not have been a subreg 'hi16' for the 16445 reg - this reg is 16 bits. I would have wished that the 16507:hi16 be interpreted as the corresponding subregister, and thus generated in the COPY with a :hi16. It is all right that the 16445 is of 16 bits, this is correct, but then it is used incorrectly with a :hi16 subregister value ?? Any ideas?<br><br>I am trying to use register classes as follows: I have one register class for 32 bit registers, and another one for the subregisters of 16 bits. Intuitively, I would like to use instructions with operands of the 16 bit register class, and then be able to use 32 bit registers with a subregister index. Is this possible, or need I make a new register class where all these are included in a blended fashion: 16/32 bits, and use this instead for the instruction?<br><br>I have defined the 16 bit registers as subregs to the 32 bits. I have also defined subregclasses, as per  let SubRegClasses =... <br><br>2. Insert COPY's, but these would not get coalesced away, so instead of saving instructions I ended up with one load and two moves...:-( How could I get the wide load to simply be used intelligently by COPYing to the old virtual registers?<br><br>I would appreciate any advice on how to get good code with a SIMD combinations as in the example above! What would the general layout of register classes typically look like? I imagine the best approach is the first one, where the operands simply get updated, without any COPY's introduced.<br><br>Thanks,<br><br>Jonas<br><br><br><br><br><br>                                    </body>
</html>