{
tree x;
- if (mo == MEMMODEL_LAST)
+ if (mo == MEMMODEL_LAST || mo == MEMMODEL_SEQ_CST)
{
x = builtin_decl_explicit (BUILT_IN_SYNC_SYNCHRONIZE);
x = build_call_expr_loc (loc, x, 0);
const char *p
= IDENTIFIER_POINTER (c_parser_peek_token (parser)->value);
- if (!strcmp (p, "acq_rel"))
+ if (!strcmp (p, "seq_cst"))
+ mo = MEMMODEL_SEQ_CST;
+ else if (!strcmp (p, "acq_rel"))
mo = MEMMODEL_ACQ_REL;
else if (!strcmp (p, "release"))
mo = MEMMODEL_RELEASE;
mo = MEMMODEL_ACQUIRE;
else
error_at (c_parser_peek_token (parser)->location,
- "expected %<acq_rel%>, %<release%> or %<acquire%>");
+ "expected %<seq_cst%>, %<acq_rel%>, %<release%> or "
+ "%<acquire%>");
c_parser_consume_token (parser);
}
if (c_parser_next_token_is (parser, CPP_OPEN_PAREN))
{
tree id = cp_lexer_peek_token (parser->lexer)->u.value;
const char *p = IDENTIFIER_POINTER (id);
- if (!strcmp (p, "acq_rel"))
+ if (!strcmp (p, "seq_cst"))
+ mo = MEMMODEL_SEQ_CST;
+ else if (!strcmp (p, "acq_rel"))
mo = MEMMODEL_ACQ_REL;
else if (!strcmp (p, "release"))
mo = MEMMODEL_RELEASE;
mo = MEMMODEL_ACQUIRE;
else
error_at (cp_lexer_peek_token (parser->lexer)->location,
- "expected %<acq_rel%>, %<release%> or %<acquire%>");
+ "expected %<seq_cst%>, %<acq_rel%>, %<release%> or "
+ "%<acquire%>");
cp_lexer_consume_token (parser->lexer);
}
if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN))
{
tree fn = builtin_decl_explicit (BUILT_IN_SYNC_SYNCHRONIZE);
releasing_vec vec;
- if (mo != MEMMODEL_LAST)
+ if (mo != MEMMODEL_LAST && mo != MEMMODEL_SEQ_CST)
{
fn = builtin_decl_explicit (BUILT_IN_ATOMIC_THREAD_FENCE);
vec->quick_push (build_int_cst (integer_type_node, mo));
enum gfc_omp_memorder mo = OMP_MEMORDER_UNSET;
if (gfc_match_omp_eos () == MATCH_NO && gfc_peek_ascii_char () != '(')
{
- if (gfc_match ("acq_rel") == MATCH_YES)
+ if (gfc_match ("seq_cst") == MATCH_YES)
+ mo = OMP_MEMORDER_SEQ_CST;
+ else if (gfc_match ("acq_rel") == MATCH_YES)
mo = OMP_MEMORDER_ACQ_REL;
else if (gfc_match ("release") == MATCH_YES)
mo = OMP_MEMORDER_RELEASE;
mo = OMP_MEMORDER_ACQUIRE;
else
{
- gfc_error ("Expected AQC_REL, RELEASE, or ACQUIRE at %C");
+ gfc_error ("Expected SEQ_CST, AQC_REL, RELEASE, or ACQUIRE at %C");
return MATCH_ERROR;
}
c = gfc_get_omp_clauses ();
{
tree call;
if (!code->ext.omp_clauses
- || code->ext.omp_clauses->memorder == OMP_MEMORDER_UNSET)
+ || code->ext.omp_clauses->memorder == OMP_MEMORDER_UNSET
+ || code->ext.omp_clauses->memorder == OMP_MEMORDER_SEQ_CST)
{
call = builtin_decl_explicit (BUILT_IN_SYNC_SYNCHRONIZE);
call = build_call_expr_loc (input_location, call, 0);
/* { dg-additional-options "-fdump-tree-gimple" } */
+/* { dg-final { scan-tree-dump "foo \\(6\\);\[\n\r]* __sync_synchronize \\(\\);\[\n\r]* foo \\(6\\);" "gimple" } } */
/* { dg-final { scan-tree-dump "foo \\(4\\);\[\n\r]* __atomic_thread_fence \\(4\\);\[\n\r]* foo \\(4\\);" "gimple" } } */
/* { dg-final { scan-tree-dump "foo \\(3\\);\[\n\r]* __atomic_thread_fence \\(3\\);\[\n\r]* foo \\(3\\);" "gimple" } } */
/* { dg-final { scan-tree-dump "foo \\(2\\);\[\n\r]* __atomic_thread_fence \\(2\\);\[\n\r]* foo \\(2\\);" "gimple" } } */
#pragma omp flush
foo (5);
}
+
+void
+f5 (void)
+{
+ foo (6);
+ #pragma omp flush seq_cst
+ foo (6);
+}
#pragma omp flush acquire
#pragma omp flush release
#pragma omp flush acq_rel
- #pragma omp flush relaxed /* { dg-error "expected 'acq_rel', 'release' or 'acquire'" } */
- #pragma omp flush seq_cst /* { dg-error "expected 'acq_rel', 'release' or 'acquire'" } */
- #pragma omp flush foobar /* { dg-error "expected 'acq_rel', 'release' or 'acquire'" } */
+ #pragma omp flush seq_cst
+ #pragma omp flush relaxed /* { dg-error "expected 'seq_cst', 'acq_rel', 'release' or 'acquire'" } */
+ #pragma omp flush foobar /* { dg-error "expected 'seq_cst', 'acq_rel', 'release' or 'acquire'" } */
#pragma omp flush acquire (a, b) /* { dg-error "'flush' list specified together with memory order clause" } */
#pragma omp flush release (a, b) /* { dg-error "'flush' list specified together with memory order clause" } */
#pragma omp flush acq_rel (a, b) /* { dg-error "'flush' list specified together with memory order clause" } */
+ #pragma omp flush seq_cst (a, b) /* { dg-error "'flush' list specified together with memory order clause" } */
}
;
[[omp::directive (flush acq_rel)]]
;
+ [[omp::directive (flush acquire)]]
+ ;
+ [[omp::directive (flush release)]]
+ ;
+ [[omp::directive (flush seq_cst)]]
+ ;
[[omp::directive (flush (p, f))]]
;
[[omp::directive (simd
;
[[omp::directive (flush, acq_rel)]]
;
+ [[omp::directive (flush, acquire)]]
+ ;
+ [[omp::directive (flush, release)]]
+ ;
+ [[omp::directive (flush, seq_cst)]]
+ ;
[[omp::directive (flush (p, f))]]
;
[[omp::directive (simd,
! { dg-additional-options "-fdump-tree-gimple" }
+! { dg-final { scan-tree-dump "foo \\(6\\);\[\n\r]* __sync_synchronize \\(\\);\[\n\r]* foo \\(6\\);" "gimple" } }
! { dg-final { scan-tree-dump "foo \\(4\\);\[\n\r]* __atomic_thread_fence \\(4\\);\[\n\r]* foo \\(4\\);" "gimple" } }
! { dg-final { scan-tree-dump "foo \\(3\\);\[\n\r]* __atomic_thread_fence \\(3\\);\[\n\r]* foo \\(3\\);" "gimple" } }
! { dg-final { scan-tree-dump "foo \\(2\\);\[\n\r]* __atomic_thread_fence \\(2\\);\[\n\r]* foo \\(2\\);" "gimple" } }
!$omp flush
call foo (5)
end
+
+subroutine f5
+ use m
+ call foo (6)
+ !$omp flush seq_cst
+ call foo (6)
+end
!$omp flush acquire
!$omp flush release
!$omp flush acq_rel
- !$omp flush relaxed ! { dg-error "Expected AQC_REL, RELEASE, or ACQUIRE" }
- !$omp flush seq_cst ! { dg-error "Expected AQC_REL, RELEASE, or ACQUIRE" }
- !$omp flush foobar ! { dg-error "Expected AQC_REL, RELEASE, or ACQUIRE" }
+ !$omp flush seq_cst
+ !$omp flush relaxed ! { dg-error "Expected SEQ_CST, AQC_REL, RELEASE, or ACQUIRE" }
+ !$omp flush foobar ! { dg-error "Expected SEQ_CST, AQC_REL, RELEASE, or ACQUIRE" }
!$omp flush acquire (a, b) ! { dg-error "List specified together with memory order clause in FLUSH directive" }
!$omp flush release (a, b) ! { dg-error "List specified together with memory order clause in FLUSH directive" }
!$omp flush acq_rel (a, b) ! { dg-error "List specified together with memory order clause in FLUSH directive" }
-end
+ !$omp flush seq_cst (a, b) ! { dg-error "List specified together with memory order clause in FLUSH directive" }
+ end