As was pointed out, __get_builtin_sync_mem was renamed to __get_builtin_atomic which isn't really right, so this patch renames it back.

It also includes some formatting fixes which resulted from __sync_mem having a different number of letters than __atomic.

Andrew


        * optabs.c (add_op): Fix formatting from rename.
        (expand_atomic_fetch_op): Fix formatting from rename.
        * builtins.c (get_builtin_sync_mem): Reverse renamed get_builtin_atomic.
        (expand_builtin_sync_operation): Fix rename issues.
        (expand_builtin_compare_and_swap): Fix rename issues.
        (expand_builtin_sync_lock_test_and_set): Fix rename issues.
        (expand_builtin_sync_lock_release): Fix rename issues.
        (expand_builtin_atomic_exchange): Fix rename issues.
        (expand_builtin_atomic_compare_exchange): Fix rename issues.
        (expand_builtin_atomic_load): Fix rename issues.
        (expand_builtin_atomic_store): Fix rename issues.
        (expand_builtin_atomic_fetch_op): Fix rename issues.
        (expand_builtin): Fix formatting from rename.

Index: optabs.c
===================================================================
*** optabs.c    (revision 180174)
--- optabs.c    (working copy)
*************** struct op_functions {
*** 7228,7239 ****
  
  /* Initialize the fields for each supported opcode.  */
  static const struct op_functions add_op = { atomic_fetch_add_optab,
!                                     atomic_add_fetch_optab,
!                                     atomic_add_optab,
!                                     sync_old_add_optab,
!                                     sync_new_add_optab,
!                                     sync_add_optab,
!                                     MINUS
                                    };
  
  static const struct op_functions sub_op = { atomic_fetch_sub_optab,
--- 7228,7239 ----
  
  /* Initialize the fields for each supported opcode.  */
  static const struct op_functions add_op = { atomic_fetch_add_optab,
!                                           atomic_add_fetch_optab,
!                                           atomic_add_optab,
!                                           sync_old_add_optab,
!                                           sync_new_add_optab,
!                                           sync_add_optab,
!                                           MINUS
                                    };
  
  static const struct op_functions sub_op = { atomic_fetch_sub_optab,
*************** maybe_emit_op (const struct op_functions
*** 7358,7364 ****
     AFTER is false to return the value before the operation (fetch_OP).  */
  rtx
  expand_atomic_fetch_op (rtx target, rtx mem, rtx val, enum rtx_code code,
!                         enum memmodel model, bool after)
  {
    enum machine_mode mode = GET_MODE (mem);
    const struct op_functions *optab;
--- 7358,7364 ----
     AFTER is false to return the value before the operation (fetch_OP).  */
  rtx
  expand_atomic_fetch_op (rtx target, rtx mem, rtx val, enum rtx_code code,
!                       enum memmodel model, bool after)
  {
    enum machine_mode mode = GET_MODE (mem);
    const struct op_functions *optab;
Index: builtins.c
===================================================================
*** builtins.c  (revision 180174)
--- builtins.c  (working copy)
*************** get_builtin_sync_mode (int fcode_diff)
*** 5072,5078 ****
     for the builtin_sync operations.  */
  
  static rtx
! get_builtin_atomic (tree loc, enum machine_mode mode)
  {
    rtx addr, mem;
  
--- 5072,5078 ----
     for the builtin_sync operations.  */
  
  static rtx
! get_builtin_sync_mem (tree loc, enum machine_mode mode)
  {
    rtx addr, mem;
  
*************** expand_builtin_sync_operation (enum mach
*** 5173,5183 ****
      }
  
    /* Expand the operands.  */
!   mem = get_builtin_atomic (CALL_EXPR_ARG (exp, 0), mode);
    val = expand_expr_force_mode (CALL_EXPR_ARG (exp, 1), mode);
  
    return expand_atomic_fetch_op (target, mem, val, code, MEMMODEL_SEQ_CST,
!                                    after);
  }
  
  /* Expand the __sync_val_compare_and_swap and __sync_bool_compare_and_swap
--- 5173,5183 ----
      }
  
    /* Expand the operands.  */
!   mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode);
    val = expand_expr_force_mode (CALL_EXPR_ARG (exp, 1), mode);
  
    return expand_atomic_fetch_op (target, mem, val, code, MEMMODEL_SEQ_CST,
!                                after);
  }
  
  /* Expand the __sync_val_compare_and_swap and __sync_bool_compare_and_swap
*************** expand_builtin_compare_and_swap (enum ma
*** 5192,5198 ****
    rtx old_val, new_val, mem;
  
    /* Expand the operands.  */
!   mem = get_builtin_atomic (CALL_EXPR_ARG (exp, 0), mode);
    old_val = expand_expr_force_mode (CALL_EXPR_ARG (exp, 1), mode);
    new_val = expand_expr_force_mode (CALL_EXPR_ARG (exp, 2), mode);
  
--- 5192,5198 ----
    rtx old_val, new_val, mem;
  
    /* Expand the operands.  */
!   mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode);
    old_val = expand_expr_force_mode (CALL_EXPR_ARG (exp, 1), mode);
    new_val = expand_expr_force_mode (CALL_EXPR_ARG (exp, 2), mode);
  
*************** expand_builtin_sync_lock_test_and_set (e
*** 5215,5221 ****
    rtx val, mem;
  
    /* Expand the operands.  */
!   mem = get_builtin_atomic (CALL_EXPR_ARG (exp, 0), mode);
    val = expand_expr_force_mode (CALL_EXPR_ARG (exp, 1), mode);
  
    return expand_atomic_exchange (target, mem, val, MEMMODEL_ACQUIRE);
--- 5215,5221 ----
    rtx val, mem;
  
    /* Expand the operands.  */
!   mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode);
    val = expand_expr_force_mode (CALL_EXPR_ARG (exp, 1), mode);
  
    return expand_atomic_exchange (target, mem, val, MEMMODEL_ACQUIRE);
*************** expand_builtin_sync_lock_release (enum m
*** 5229,5235 ****
    rtx mem;
  
    /* Expand the operands.  */
!   mem = get_builtin_atomic (CALL_EXPR_ARG (exp, 0), mode);
  
    expand_atomic_store (mem, const0_rtx, MEMMODEL_RELEASE);
  }
--- 5229,5235 ----
    rtx mem;
  
    /* Expand the operands.  */
!   mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode);
  
    expand_atomic_store (mem, const0_rtx, MEMMODEL_RELEASE);
  }
*************** expand_builtin_atomic_exchange (enum mac
*** 5275,5281 ****
      }
  
    /* Expand the operands.  */
!   mem = get_builtin_atomic (CALL_EXPR_ARG (exp, 0), mode);
    val = expand_expr_force_mode (CALL_EXPR_ARG (exp, 1), mode);
  
    return expand_atomic_exchange (target, mem, val, model);
--- 5275,5281 ----
      }
  
    /* Expand the operands.  */
!   mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode);
    val = expand_expr_force_mode (CALL_EXPR_ARG (exp, 1), mode);
  
    return expand_atomic_exchange (target, mem, val, model);
*************** expand_builtin_atomic_exchange (enum mac
*** 5283,5290 ****
  
  /* Expand the __atomic_compare_exchange intrinsic:
        bool __atomic_compare_exchange (TYPE *object, TYPE *expect, 
!                                         TYPE desired, enum memmodel success,
!                                         enum memmodel failure)
     EXP is the CALL_EXPR.
     TARGET is an optional place for us to store the results.  */
  
--- 5283,5290 ----
  
  /* Expand the __atomic_compare_exchange intrinsic:
        bool __atomic_compare_exchange (TYPE *object, TYPE *expect, 
!                                       TYPE desired, enum memmodel success,
!                                       enum memmodel failure)
     EXP is the CALL_EXPR.
     TARGET is an optional place for us to store the results.  */
  
*************** expand_builtin_atomic_compare_exchange (
*** 5311,5317 ****
      }
    
    /* Expand the operands.  */
!   mem = get_builtin_atomic (CALL_EXPR_ARG (exp, 0), mode);
  
    expect = expand_expr (CALL_EXPR_ARG (exp, 1), NULL_RTX, ptr_mode, 
                        EXPAND_NORMAL);
--- 5311,5317 ----
      }
    
    /* Expand the operands.  */
!   mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode);
  
    expect = expand_expr (CALL_EXPR_ARG (exp, 1), NULL_RTX, ptr_mode, 
                        EXPAND_NORMAL);
*************** expand_builtin_atomic_load (enum machine
*** 5343,5349 ****
      }
  
    /* Expand the operand.  */
!   mem = get_builtin_atomic (CALL_EXPR_ARG (exp, 0), mode);
  
    return expand_atomic_load (target, mem, model);
  }
--- 5343,5349 ----
      }
  
    /* Expand the operand.  */
!   mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode);
  
    return expand_atomic_load (target, mem, model);
  }
*************** expand_builtin_atomic_store (enum machin
*** 5370,5376 ****
      }
  
    /* Expand the operands.  */
!   mem = get_builtin_atomic (CALL_EXPR_ARG (exp, 0), mode);
    val = expand_expr_force_mode (CALL_EXPR_ARG (exp, 1), mode);
  
    return expand_atomic_store (mem, val, model);
--- 5370,5376 ----
      }
  
    /* Expand the operands.  */
!   mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode);
    val = expand_expr_force_mode (CALL_EXPR_ARG (exp, 1), mode);
  
    return expand_atomic_store (mem, val, model);
*************** expand_builtin_atomic_store (enum machin
*** 5386,5392 ****
  
  static rtx
  expand_builtin_atomic_fetch_op (enum machine_mode mode, tree exp, rtx target,
!                                 enum rtx_code code, bool fetch_after)
  {
    rtx val, mem;
    enum memmodel model;
--- 5386,5392 ----
  
  static rtx
  expand_builtin_atomic_fetch_op (enum machine_mode mode, tree exp, rtx target,
!                               enum rtx_code code, bool fetch_after)
  {
    rtx val, mem;
    enum memmodel model;
*************** expand_builtin_atomic_fetch_op (enum mac
*** 5394,5400 ****
    model = get_memmodel (CALL_EXPR_ARG (exp, 2));
  
    /* Expand the operands.  */
!   mem = get_builtin_atomic (CALL_EXPR_ARG (exp, 0), mode);
    val = expand_expr_force_mode (CALL_EXPR_ARG (exp, 1), mode);
  
    return expand_atomic_fetch_op (target, mem, val, code, model, fetch_after);
--- 5394,5400 ----
    model = get_memmodel (CALL_EXPR_ARG (exp, 2));
  
    /* Expand the operands.  */
!   mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode);
    val = expand_expr_force_mode (CALL_EXPR_ARG (exp, 1), mode);
  
    return expand_atomic_fetch_op (target, mem, val, code, model, fetch_after);
*************** expand_builtin (tree exp, rtx target, rt
*** 6408,6415 ****
      case BUILT_IN_ATOMIC_SUB_FETCH_8:
      case BUILT_IN_ATOMIC_SUB_FETCH_16:
        mode = get_builtin_sync_mode (fcode - BUILT_IN_ATOMIC_SUB_FETCH_1);
!       target = expand_builtin_atomic_fetch_op (mode, exp, target, MINUS, 
!                                                true);
        if (target)
        return target;
        break;
--- 6408,6414 ----
      case BUILT_IN_ATOMIC_SUB_FETCH_8:
      case BUILT_IN_ATOMIC_SUB_FETCH_16:
        mode = get_builtin_sync_mode (fcode - BUILT_IN_ATOMIC_SUB_FETCH_1);
!       target = expand_builtin_atomic_fetch_op (mode, exp, target, MINUS, 
true);
        if (target)
        return target;
        break;
*************** expand_builtin (tree exp, rtx target, rt
*** 6465,6472 ****
      case BUILT_IN_ATOMIC_FETCH_ADD_8:
      case BUILT_IN_ATOMIC_FETCH_ADD_16:
        mode = get_builtin_sync_mode (fcode - BUILT_IN_ATOMIC_FETCH_ADD_1);
!       target = expand_builtin_atomic_fetch_op (mode, exp, target, PLUS,
!                                                false);
        if (target)
        return target;
        break;
--- 6464,6470 ----
      case BUILT_IN_ATOMIC_FETCH_ADD_8:
      case BUILT_IN_ATOMIC_FETCH_ADD_16:
        mode = get_builtin_sync_mode (fcode - BUILT_IN_ATOMIC_FETCH_ADD_1);
!       target = expand_builtin_atomic_fetch_op (mode, exp, target, PLUS, 
false);
        if (target)
        return target;
        break;
*************** expand_builtin (tree exp, rtx target, rt
*** 6477,6484 ****
      case BUILT_IN_ATOMIC_FETCH_SUB_8:
      case BUILT_IN_ATOMIC_FETCH_SUB_16:
        mode = get_builtin_sync_mode (fcode - BUILT_IN_ATOMIC_FETCH_SUB_1);
!       target = expand_builtin_atomic_fetch_op (mode, exp, target, MINUS,
!                                                false);
        if (target)
        return target;
        break;
--- 6475,6481 ----
      case BUILT_IN_ATOMIC_FETCH_SUB_8:
      case BUILT_IN_ATOMIC_FETCH_SUB_16:
        mode = get_builtin_sync_mode (fcode - BUILT_IN_ATOMIC_FETCH_SUB_1);
!       target = expand_builtin_atomic_fetch_op (mode, exp, target, MINUS, 
false);
        if (target)
        return target;
        break;

Reply via email to