-  if (mode == QImode || mode == HImode)
+  /* On power8, we want to use SImode for the operation.  On previoius systems,
+     use the operation in a subword and shift/mask to get the proper byte or
+     halfword.  */
+  if (TARGET_SYNC_HI_QI && (mode == QImode || mode == HImode))
+    {
+      val = convert_modes (SImode, mode, val, 1);
+
+      /* Prepare to adjust the return value.  */
+      before = gen_reg_rtx (SImode);
+      if (after)
+    after = gen_reg_rtx (SImode);
+      mode = SImode;
+    }
+  else if (mode == QImode || mode == HImode)

Spelling: previoius.

This logic is redundant. Why not

if (mode == QImode || mode == HImode)
  {
    if (TARGET_SYNC_HI_QI)
      {
         new code
      }
    else
      {
         original code
      }

The rest of this patch is okay.

Thanks, David

Reply via email to