1  /* { dg-do compile { target arm*-*-* } } */
       2  /* { dg-require-effective-target arm_arm_ok } */
       3  /* { dg-require-effective-target arm_arch_v8a_ok } */
       4  /* { dg-options "-O2 -marm" } */
       5  /* { dg-add-options arm_arch_v8a } */
       6  
       7  /* We want to test that the STL instruction gets the conditional
       8     suffix when under a COND_EXEC.  However, COND_EXEC is very hard to
       9     generate from C code because the atomic_store expansion adds a compiler
      10     barrier before the insn, preventing if-conversion.  So test the output
      11     here with a hand-crafted COND_EXEC wrapped around an STL.  */
      12  
      13  void __RTL (startwith ("final")) foo (int *a, int b)
      14  {
      15  (function "foo"
      16    (param "a"
      17      (DECL_RTL (reg/v:SI r0))
      18      (DECL_RTL_INCOMING (reg:SI r0))
      19    )
      20    (param "b"
      21      (DECL_RTL (reg/v:SI r1))
      22      (DECL_RTL_INCOMING (reg:SI r1))
      23    )
      24    (insn-chain
      25      (block 2
      26  	(edge-from entry (flags "FALLTHRU"))
      27  	(cnote 5 [bb 2] NOTE_INSN_BASIC_BLOCK)
      28  
      29    (insn:TI 7 (parallel [
      30  	(set (reg:CC cc)
      31  	     (compare:CC (reg:SI r1)
      32  			 (const_int 0)))
      33  	(set (reg/v:SI r1)
      34  	     (reg:SI r1 ))
      35          ])  ;; {*movsi_compare0}
      36       (nil))
      37  
      38    ;; A conditional atomic store-release: STLNE for Armv8-A.
      39    (insn 10 (cond_exec (ne (reg:CC cc)
      40  	   (const_int 0))
      41  	(set (mem/v:SI (reg/v/f:SI r0) [-1  S4 A32])
      42  		(unspec_volatile:SI [
      43  		(reg/v:SI r1)
      44  		(const_int 3)
      45  		] VUNSPEC_STL))) ;; {*p atomic_storesi}
      46  	(expr_list:REG_DEAD (reg:CC cc)
      47  	(expr_list:REG_DEAD (reg/v:SI r1)
      48  	(expr_list:REG_DEAD (reg/v/f:SI r0)
      49  		(nil)))))
      50        (edge-to exit (flags "FALLTHRU"))
      51      ) ;; block 2
      52    ) ;; insn-chain
      53    (crtl
      54      (return_rtx
      55        (reg/i:SI r0)
      56      ) ;; return_rtx
      57    ) ;; crtl
      58  ) ;; function
      59  }
      60  
      61  /* { dg-final { scan-assembler "stlne" } } */