OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.target/] [arm/] [neon-thumb2-move.c] - Blame information for rev 826

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 313 jeremybenn
/* { dg-do compile } */
2
/* { dg-require-effective-target arm_neon_ok } */
3
/* { dg-options "-O2 -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon" } */
4
 
5
#include <arm_neon.h>
6
#include <stddef.h>
7
 
8
void *
9
memset (DST, C, LENGTH)
10
     void *DST;
11
     int C;
12
     size_t LENGTH;
13
{
14
  void* DST0 = DST;
15
  unsigned char C_BYTE = C;
16
 
17
 
18
  if (__builtin_expect(LENGTH < 4, 1)) {
19
    size_t i = 0;
20
    while (i < LENGTH) {
21
      ((char*)DST)[i] = C_BYTE;
22
      i++;
23
    }
24
    return DST;
25
  }
26
 
27
  const char* DST_end = (char*)DST + LENGTH;
28
 
29
 
30
  while ((uintptr_t)DST % 4 != 0) {
31
    *(char*) (DST++) = C_BYTE;
32
  }
33
 
34
 
35
  uint32_t C_SHORTWORD = (uint32_t)(unsigned char)(C_BYTE) * 0x01010101;
36
 
37
 
38
  if (__builtin_expect(DST_end - (char*)DST >= 16, 0)) {
39
    while ((uintptr_t)DST % 16 != 0) {
40
      *((uint32_t*)((char*)(DST) + (0))) = C_SHORTWORD;
41
      DST += 4;
42
    }
43
 
44
 
45
    uint8x16_t C_WORD = vdupq_n_u8(C_BYTE);
46
 
47
 
48
 
49
 
50
 
51
    size_t i = 0;
52
    LENGTH = DST_end - (char*)DST;
53
    while (i + 16 * 16 <= LENGTH) {
54
      *((uint8x16_t*)((char*)(DST) + (i))) = C_WORD;
55
      *((uint8x16_t*)((char*)(DST) + (i + 16 * 1))) = C_WORD;
56
      *((uint8x16_t*)((char*)(DST) + (i + 16 * 2))) = C_WORD;
57
      *((uint8x16_t*)((char*)(DST) + (i + 16 * 3))) = C_WORD;
58
      *((uint8x16_t*)((char*)(DST) + (i + 16 * 4))) = C_WORD;
59
      *((uint8x16_t*)((char*)(DST) + (i + 16 * 5))) = C_WORD;
60
      *((uint8x16_t*)((char*)(DST) + (i + 16 * 6))) = C_WORD;
61
      *((uint8x16_t*)((char*)(DST) + (i + 16 * 7))) = C_WORD;
62
      *((uint8x16_t*)((char*)(DST) + (i + 16 * 8))) = C_WORD;
63
      *((uint8x16_t*)((char*)(DST) + (i + 16 * 9))) = C_WORD;
64
      *((uint8x16_t*)((char*)(DST) + (i + 16 * 10))) = C_WORD;
65
      *((uint8x16_t*)((char*)(DST) + (i + 16 * 11))) = C_WORD;
66
      *((uint8x16_t*)((char*)(DST) + (i + 16 * 12))) = C_WORD;
67
      *((uint8x16_t*)((char*)(DST) + (i + 16 * 13))) = C_WORD;
68
      *((uint8x16_t*)((char*)(DST) + (i + 16 * 14))) = C_WORD;
69
      *((uint8x16_t*)((char*)(DST) + (i + 16 * 15))) = C_WORD;
70
      i += 16 * 16;
71
    }
72
    while (i + 16 * 4 <= LENGTH) {
73
      *((uint8x16_t*)((char*)(DST) + (i))) = C_WORD;
74
      *((uint8x16_t*)((char*)(DST) + (i + 16 * 1))) = C_WORD;
75
      *((uint8x16_t*)((char*)(DST) + (i + 16 * 2))) = C_WORD;
76
      *((uint8x16_t*)((char*)(DST) + (i + 16 * 3))) = C_WORD;
77
      i += 16 * 4;
78
    }
79
    while (i + 16 <= LENGTH) {
80
      *((uint8x16_t*)((char*)(DST) + (i))) = C_WORD;
81
      i += 16;
82
    }
83
    DST += i;
84
  }
85
 
86
  while (4 <= DST_end - (char*)DST) {
87
    *((uint32_t*)((char*)(DST) + (0))) = C_SHORTWORD;
88
    DST += 4;
89
  }
90
 
91
 
92
  while ((char*)DST < DST_end) {
93
    *((char*)DST) = C_BYTE;
94
    DST++;
95
  }
96
 
97
  return DST0;
98
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.