Attachment 'C11atomic4.patch'

Download

   1 Index: libstdc++-v3/include/bits/atomic_base.h
   2 ===================================================================
   3 *** libstdc++-v3/include/bits/atomic_base.h	(revision 202709)
   4 --- libstdc++-v3/include/bits/atomic_base.h	(working copy)
   5 *************** _GLIBCXX_BEGIN_NAMESPACE_VERSION
   6 *** 346,361 ****
   7     // atomic_char32_t char32_t
   8     // atomic_wchar_t  wchar_t
   9     //
  10 !   // NB: Assuming _ITp is an integral scalar type that is 1, 2, 4, or
  11 !   // 8 bytes, since that is what GCC built-in functions for atomic
  12     // memory access expect.
  13     template<typename _ITp>
  14       struct __atomic_base
  15       {
  16       private:
  17 !       typedef _ITp 	__int_type;
  18   
  19 !       __int_type 	_M_i;
  20   
  21       public:
  22         __atomic_base() noexcept = default;
  23 --- 346,362 ----
  24     // atomic_char32_t char32_t
  25     // atomic_wchar_t  wchar_t
  26     //
  27 !   // NB: Assuming _ITp is an integral scalar type that is 1, 2, 4, 8, or
  28 !   // 16 bytes, since that is what GCC built-in functions for atomic
  29     // memory access expect.
  30     template<typename _ITp>
  31       struct __atomic_base
  32       {
  33       private:
  34 !       typedef _ITp 				__int_type;
  35 !       typedef _ITp __attribute__ ((atomic))	__atomic_int_type;
  36   
  37 !       __atomic_int_type _M_i;
  38   
  39       public:
  40         __atomic_base() noexcept = default;
  41 *************** _GLIBCXX_BEGIN_NAMESPACE_VERSION
  42 *** 669,677 ****
  43       struct __atomic_base<_PTp*>
  44       {
  45       private:
  46 !       typedef _PTp* 	__pointer_type;
  47   
  48 !       __pointer_type 	_M_p;
  49   
  50         // Factored out to facilitate explicit specialization.
  51         constexpr ptrdiff_t
  52 --- 670,679 ----
  53       struct __atomic_base<_PTp*>
  54       {
  55       private:
  56 !       typedef _PTp* 				__pointer_type;
  57 !       typedef _PTp* __attribute ((atomic)) 	__atomic_pointer_type;
  58   
  59 !       __atomic_pointer_type 	_M_p;
  60   
  61         // Factored out to facilitate explicit specialization.
  62         constexpr ptrdiff_t
  63 Index: libstdc++-v3/include/std/atomic
  64 ===================================================================
  65 *** libstdc++-v3/include/std/atomic	(revision 202709)
  66 --- libstdc++-v3/include/std/atomic	(working copy)
  67 *************** _GLIBCXX_BEGIN_NAMESPACE_VERSION
  68 *** 161,167 ****
  69       struct atomic
  70       {
  71       private:
  72 !       _Tp _M_i;
  73   
  74       public:
  75         atomic() noexcept = default;
  76 --- 161,167 ----
  77       struct atomic
  78       {
  79       private:
  80 !       _Tp __attribute ((atomic)) _M_i;
  81   
  82       public:
  83         atomic() noexcept = default;
  84 Index: gcc/testsuite/gcc.dg/atomic-exchange-1.c
  85 ===================================================================
  86 *** gcc/testsuite/gcc.dg/atomic-exchange-1.c	(revision 202709)
  87 --- gcc/testsuite/gcc.dg/atomic-exchange-1.c	(working copy)
  88 ***************
  89 *** 7,13 ****
  90   
  91   extern void abort(void);
  92   
  93 ! char v, count, ret;
  94   
  95   main ()
  96   {
  97 --- 7,14 ----
  98   
  99   extern void abort(void);
 100   
 101 ! char __attribute__ ((atomic)) v;
 102 ! char count, ret;
 103   
 104   main ()
 105   {
 106 Index: gcc/testsuite/gcc.dg/atomic-exchange-2.c
 107 ===================================================================
 108 *** gcc/testsuite/gcc.dg/atomic-exchange-2.c	(revision 202709)
 109 --- gcc/testsuite/gcc.dg/atomic-exchange-2.c	(working copy)
 110 ***************
 111 *** 7,13 ****
 112   
 113   extern void abort(void);
 114   
 115 ! short v, count, ret;
 116   
 117   main ()
 118   {
 119 --- 7,14 ----
 120   
 121   extern void abort(void);
 122   
 123 ! short __attribute__ ((atomic)) v;
 124 ! short count, ret;
 125   
 126   main ()
 127   {
 128 Index: gcc/testsuite/gcc.dg/atomic-exchange-3.c
 129 ===================================================================
 130 *** gcc/testsuite/gcc.dg/atomic-exchange-3.c	(revision 202709)
 131 --- gcc/testsuite/gcc.dg/atomic-exchange-3.c	(working copy)
 132 ***************
 133 *** 7,13 ****
 134   
 135   extern void abort(void);
 136   
 137 ! int v, count, ret;
 138   
 139   main ()
 140   {
 141 --- 7,14 ----
 142   
 143   extern void abort(void);
 144   
 145 ! int __attribute__ ((atomic)) v;
 146 ! int count, ret;
 147   
 148   main ()
 149   {
 150 Index: gcc/testsuite/gcc.dg/atomic-exchange-4.c
 151 ===================================================================
 152 *** gcc/testsuite/gcc.dg/atomic-exchange-4.c	(revision 202709)
 153 --- gcc/testsuite/gcc.dg/atomic-exchange-4.c	(working copy)
 154 ***************
 155 *** 9,15 ****
 156   
 157   extern void abort(void);
 158   
 159 ! long long v, count, ret;
 160   
 161   main ()
 162   {
 163 --- 9,16 ----
 164   
 165   extern void abort(void);
 166   
 167 ! long long __attribute__ ((atomic)) v;
 168 ! long long count, ret;
 169   
 170   main ()
 171   {
 172 Index: gcc/testsuite/gcc.dg/atomic-exchange-5.c
 173 ===================================================================
 174 *** gcc/testsuite/gcc.dg/atomic-exchange-5.c	(revision 202709)
 175 --- gcc/testsuite/gcc.dg/atomic-exchange-5.c	(working copy)
 176 ***************
 177 *** 8,14 ****
 178   
 179   extern void abort(void);
 180   
 181 ! __int128_t v, count, ret;
 182   
 183   main ()
 184   {
 185 --- 8,15 ----
 186   
 187   extern void abort(void);
 188   
 189 ! __int128_t __attribute__ ((atomic)) v;
 190 ! __int128_t count, ret;
 191   
 192   main ()
 193   {
 194 Index: gcc/testsuite/gcc.dg/atomic-op-1.c
 195 ===================================================================
 196 *** gcc/testsuite/gcc.dg/atomic-op-1.c	(revision 202709)
 197 --- gcc/testsuite/gcc.dg/atomic-op-1.c	(working copy)
 198 ***************
 199 *** 1,13 ****
 200   /* Test __atomic routines for existence and proper execution on 1 byte 
 201      values with each valid memory model.  */
 202   /* { dg-do run } */
 203   /* { dg-require-effective-target sync_char_short } */
 204   
 205   /* Test the execution of the __atomic_*OP builtin routines for a char.  */
 206   
 207   extern void abort(void);
 208   
 209 ! char v, count, res;
 210   const char init = ~0;
 211   
 212   /* The fetch_op routines return the original value before the operation.  */
 213 --- 1,15 ----
 214   /* Test __atomic routines for existence and proper execution on 1 byte 
 215      values with each valid memory model.  */
 216   /* { dg-do run } */
 217 + /* { dg-options "--std=c11" } */
 218   /* { dg-require-effective-target sync_char_short } */
 219   
 220   /* Test the execution of the __atomic_*OP builtin routines for a char.  */
 221   
 222   extern void abort(void);
 223   
 224 ! _Atomic char v;
 225 ! char count, res;
 226   const char init = ~0;
 227   
 228   /* The fetch_op routines return the original value before the operation.  */
 229 *************** test_or ()
 230 *** 527,532 ****
 231 --- 529,535 ----
 232       abort ();
 233   }
 234   
 235 + int
 236   main ()
 237   {
 238     test_fetch_add ();
 239 Index: gcc/testsuite/gcc.dg/atomic-op-2.c
 240 ===================================================================
 241 *** gcc/testsuite/gcc.dg/atomic-op-2.c	(revision 202709)
 242 --- gcc/testsuite/gcc.dg/atomic-op-2.c	(working copy)
 243 ***************
 244 *** 1,6 ****
 245 --- 1,7 ----
 246   /* Test __atomic routines for existence and proper execution on 2 byte 
 247      values with each valid memory model.  */
 248   /* { dg-do run } */
 249 + /* { dg-options "--std=c11" } */
 250   /* { dg-require-effective-target sync_char_short } */
 251   
 252   
 253 ***************
 254 *** 8,14 ****
 255   
 256   extern void abort(void);
 257   
 258 ! short v, count, res;
 259   const short init = ~0;
 260   
 261   /* The fetch_op routines return the original value before the operation.  */
 262 --- 9,16 ----
 263   
 264   extern void abort(void);
 265   
 266 ! _Atomic short v;
 267 ! short count, res;
 268   const short init = ~0;
 269   
 270   /* The fetch_op routines return the original value before the operation.  */
 271 *************** test_or ()
 272 *** 528,533 ****
 273 --- 530,536 ----
 274       abort ();
 275   }
 276   
 277 + int
 278   main ()
 279   {
 280     test_fetch_add ();
 281 Index: gcc/testsuite/gcc.dg/atomic-op-3.c
 282 ===================================================================
 283 *** gcc/testsuite/gcc.dg/atomic-op-3.c	(revision 202709)
 284 --- gcc/testsuite/gcc.dg/atomic-op-3.c	(working copy)
 285 ***************
 286 *** 1,13 ****
 287   /* Test __atomic routines for existence and proper execution on 4 byte 
 288      values with each valid memory model.  */
 289   /* { dg-do run } */
 290   /* { dg-require-effective-target sync_int_long } */
 291   
 292   /* Test the execution of the __atomic_*OP builtin routines for an int.  */
 293   
 294   extern void abort(void);
 295   
 296 ! int v, count, res;
 297   const int init = ~0;
 298   
 299   /* The fetch_op routines return the original value before the operation.  */
 300 --- 1,15 ----
 301   /* Test __atomic routines for existence and proper execution on 4 byte 
 302      values with each valid memory model.  */
 303   /* { dg-do run } */
 304 + /* { dg-options "--std=c11" } */
 305   /* { dg-require-effective-target sync_int_long } */
 306   
 307   /* Test the execution of the __atomic_*OP builtin routines for an int.  */
 308   
 309   extern void abort(void);
 310   
 311 ! _Atomic int v;
 312 ! int count, res;
 313   const int init = ~0;
 314   
 315   /* The fetch_op routines return the original value before the operation.  */
 316 *************** test_or ()
 317 *** 527,532 ****
 318 --- 529,535 ----
 319       abort ();
 320   }
 321   
 322 + int
 323   main ()
 324   {
 325     test_fetch_add ();
 326 Index: gcc/testsuite/gcc.dg/atomic-op-4.c
 327 ===================================================================
 328 *** gcc/testsuite/gcc.dg/atomic-op-4.c	(revision 202709)
 329 --- gcc/testsuite/gcc.dg/atomic-op-4.c	(working copy)
 330 ***************
 331 *** 2,15 ****
 332      values with each valid memory model.  */
 333   /* { dg-do run } */
 334   /* { dg-require-effective-target sync_long_long_runtime } */
 335 ! /* { dg-options "" } */
 336 ! /* { dg-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
 337   
 338   /* Test the execution of the __atomic_*OP builtin routines for long long.  */
 339   
 340   extern void abort(void);
 341   
 342 ! long long v, count, res;
 343   const long long init = ~0;
 344   
 345   /* The fetch_op routines return the original value before the operation.  */
 346 --- 2,16 ----
 347      values with each valid memory model.  */
 348   /* { dg-do run } */
 349   /* { dg-require-effective-target sync_long_long_runtime } */
 350 ! /* { dg-options "--std=c11" } */
 351 ! /* { dg-options "--std=c11 -march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
 352   
 353   /* Test the execution of the __atomic_*OP builtin routines for long long.  */
 354   
 355   extern void abort(void);
 356   
 357 ! _Atomic long long v;
 358 ! long long count, res;
 359   const long long init = ~0;
 360   
 361   /* The fetch_op routines return the original value before the operation.  */
 362 *************** test_or ()
 363 *** 529,534 ****
 364 --- 530,536 ----
 365       abort ();
 366   }
 367   
 368 + int
 369   main ()
 370   {
 371     test_fetch_add ();
 372 Index: gcc/testsuite/gcc.dg/atomic-op-5.c
 373 ===================================================================
 374 *** gcc/testsuite/gcc.dg/atomic-op-5.c	(revision 202709)
 375 --- gcc/testsuite/gcc.dg/atomic-op-5.c	(working copy)
 376 ***************
 377 *** 1,14 ****
 378   /* Test __atomic routines for existence and proper execution on 16 byte 
 379      values with each valid memory model.  */
 380   /* { dg-do run } */
 381   /* { dg-require-effective-target sync_int_128_runtime } */
 382 ! /* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */
 383   
 384   /* Test the execution of the __atomic_*OP builtin routines for an int_128.  */
 385   
 386   extern void abort(void);
 387   
 388 ! __int128_t v, count, res;
 389   const __int128_t init = ~0;
 390   
 391   /* The fetch_op routines return the original value before the operation.  */
 392 --- 1,16 ----
 393   /* Test __atomic routines for existence and proper execution on 16 byte 
 394      values with each valid memory model.  */
 395   /* { dg-do run } */
 396 + /* { dg-options "--std=c11" } */
 397   /* { dg-require-effective-target sync_int_128_runtime } */
 398 ! /* { dg-options "--std=c11 -mcx16" { target { i?86-*-* x86_64-*-* } } } */
 399   
 400   /* Test the execution of the __atomic_*OP builtin routines for an int_128.  */
 401   
 402   extern void abort(void);
 403   
 404 ! _Atomic __int128_t v;
 405 ! __int128_t count, res;
 406   const __int128_t init = ~0;
 407   
 408   /* The fetch_op routines return the original value before the operation.  */
 409 *************** test_or ()
 410 *** 528,533 ****
 411 --- 530,536 ----
 412       abort ();
 413   }
 414   
 415 + int
 416   main ()
 417   {
 418     test_fetch_add ();

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2013-09-26 22:28:39, 3.3 KB) [[attachment:C11atomic1.patch]]
  • [get | view] (2013-09-26 22:29:03, 10.1 KB) [[attachment:C11atomic2.patch]]
  • [get | view] (2013-09-26 22:29:32, 23.8 KB) [[attachment:C11atomic3.patch]]
  • [get | view] (2013-09-26 22:30:03, 11.1 KB) [[attachment:C11atomic4.patch]]
  • [get | view] (2013-09-26 22:30:34, 13.8 KB) [[attachment:C11atomic5.patch]]
  • [get | view] (2013-09-26 22:31:14, 0.6 KB) [[attachment:C11atomic6.patch]]
  • [get | view] (2013-09-26 22:31:49, 8.6 KB) [[attachment:C11stdatomic.patch]]
  • [get | view] (2013-09-30 15:02:51, 47.7 KB) [[attachment:atomicproto.patch]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.