Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: crosstest/test_stacksave.c

Issue 877003003: Subzero: Use a "known" version of clang-format. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Add a clang-format blacklist. Fix formatting "errors". Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « crosstest/test_stacksave.h ('k') | crosstest/test_stacksave_main.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/crosstest/test_stacksave.c - Implementation for tests ------===// 1 //===- subzero/crosstest/test_stacksave.c - Implementation for tests ------===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This aims to test that C99's VLAs (which use stacksave/stackrestore 10 // This aims to test that C99's VLAs (which use stacksave/stackrestore
(...skipping 11 matching lines...) Expand all
22 */ 22 */
23 uint32_t test_basic_vla(uint32_t size, uint32_t start, uint32_t inc) { 23 uint32_t test_basic_vla(uint32_t size, uint32_t start, uint32_t inc) {
24 uint32_t vla[size]; 24 uint32_t vla[size];
25 uint32_t mid = start + ((size - start) / 2); 25 uint32_t mid = start + ((size - start) / 2);
26 for (uint32_t i = start; i < size; ++i) { 26 for (uint32_t i = start; i < size; ++i) {
27 vla[i] = i + inc; 27 vla[i] = i + inc;
28 } 28 }
29 return (vla[start] << 2) + (vla[mid] << 1) + vla[size - 1]; 29 return (vla[start] << 2) + (vla[mid] << 1) + vla[size - 1];
30 } 30 }
31 31
32 static uint32_t __attribute__((noinline)) foo(uint32_t x) { 32 static uint32_t __attribute__((noinline)) foo(uint32_t x) { return x * x; }
33 return x * x;
34 }
35 33
36 /* NOTE: This has 1 stacksave, because the vla is in a loop and should 34 /* NOTE: This has 1 stacksave, because the vla is in a loop and should
37 * be freed before the next iteration. 35 * be freed before the next iteration.
38 */ 36 */
39 uint32_t test_vla_in_loop(uint32_t size, uint32_t start, uint32_t inc) { 37 uint32_t test_vla_in_loop(uint32_t size, uint32_t start, uint32_t inc) {
40 uint32_t sum = 0; 38 uint32_t sum = 0;
41 for (uint32_t i = start; i < size; ++i) { 39 for (uint32_t i = start; i < size; ++i) {
42 uint32_t size1 = size - i; 40 uint32_t size1 = size - i;
43 uint32_t vla[size1]; 41 uint32_t vla[size1];
44 for (uint32_t j = 0; j < size1; ++j) { 42 for (uint32_t j = 0; j < size1; ++j) {
(...skipping 22 matching lines...) Expand all
67 vla2[k] = foo(start * k + inc); 65 vla2[k] = foo(start * k + inc);
68 } 66 }
69 vla1[j] = (vla2[start2] << 2) + (vla2[mid2] << 1) + vla2[size2 - 1]; 67 vla1[j] = (vla2[start2] << 2) + (vla2[mid2] << 1) + vla2[size2 - 1];
70 } 68 }
71 for (uint32_t j = 0; j < size1; ++j) { 69 for (uint32_t j = 0; j < size1; ++j) {
72 sum += vla1[j]; 70 sum += vla1[j];
73 } 71 }
74 } 72 }
75 return sum; 73 return sum;
76 } 74 }
OLDNEW
« no previous file with comments | « crosstest/test_stacksave.h ('k') | crosstest/test_stacksave_main.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698