Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
18636ada
Commit
18636ada
authored
May 11, 2003
by
Richard Sandiford
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Missed from previous commit.
From-SVN: r66690
parent
82244e3e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
213 deletions
+0
-213
gcc/testsuite/gcc.c-torture/execute/string-opt-asm-1.c
+0
-82
gcc/testsuite/gcc.c-torture/execute/string-opt-asm-2.c
+0
-131
No files found.
gcc/testsuite/gcc.c-torture/execute/string-opt-asm-1.c
deleted
100644 → 0
View file @
82244e3e
/* Copyright (C) 2000, 2003 Free Software Foundation.
Ensure all expected transformations of builtin strstr occur and
perform correctly in presence of redirect. */
typedef
__SIZE_TYPE__
size_t
;
extern
void
abort
(
void
);
extern
char
*
strstr
(
const
char
*
,
const
char
*
)
__asm
(
"my_strstr"
);
extern
char
*
strchr
(
const
char
*
,
int
);
extern
int
strcmp
(
const
char
*
,
const
char
*
);
extern
int
strncmp
(
const
char
*
,
const
char
*
,
size_t
);
const
char
*
p
=
"rld"
,
*
q
=
"hello world"
;
int
main
(
void
)
{
const
char
*
const
foo
=
"hello world"
;
if
(
strstr
(
foo
,
""
)
!=
foo
)
abort
();
if
(
strstr
(
foo
+
4
,
""
)
!=
foo
+
4
)
abort
();
if
(
strstr
(
foo
,
"h"
)
!=
foo
)
abort
();
if
(
strstr
(
foo
,
"w"
)
!=
foo
+
6
)
abort
();
if
(
strstr
(
foo
+
6
,
"o"
)
!=
foo
+
7
)
abort
();
if
(
strstr
(
foo
+
1
,
"world"
)
!=
foo
+
6
)
abort
();
if
(
strstr
(
foo
+
2
,
p
)
!=
foo
+
8
)
abort
();
if
(
strstr
(
q
,
""
)
!=
q
)
abort
();
if
(
strstr
(
q
+
1
,
"o"
)
!=
q
+
4
)
abort
();
/* Test at least one instance of the __builtin_ style. We do this
to ensure that it works and that the prototype is correct. */
if
(
__builtin_strstr
(
foo
+
1
,
"world"
)
!=
foo
+
6
)
abort
();
return
0
;
}
/* There should be no calls to real strstr. */
static
char
*
real_strstr
(
const
char
*
,
const
char
*
)
__asm
(
"strstr"
);
__attribute__
((
noinline
))
static
char
*
real_strstr
(
const
char
*
s1
,
const
char
*
s2
)
{
abort
();
}
static
char
*
strstr
(
const
char
*
s1
,
const
char
*
s2
)
__asm
(
"my_strstr"
);
__attribute__
((
noinline
))
static
char
*
strstr
(
const
char
*
s1
,
const
char
*
s2
)
{
size_t
len
=
strlen
(
s2
);
#ifdef __OPTIMIZE__
/* If optimizing, we should be called only in the
strstr (foo + 2, p) case above. All other cases should
be optimized. */
if
(
s2
!=
p
||
strcmp
(
s1
,
"hello world"
+
2
)
!=
0
)
abort
();
#endif
if
(
len
==
0
)
return
(
char
*
)
s1
;
for
(
s1
=
strchr
(
s1
,
*
s2
);
s1
;
s1
=
strchr
(
s1
+
1
,
*
s2
))
if
(
strncmp
(
s1
,
s2
,
len
)
==
0
)
return
(
char
*
)
s1
;
return
(
char
*
)
0
;
}
gcc/testsuite/gcc.c-torture/execute/string-opt-asm-2.c
deleted
100644 → 0
View file @
82244e3e
/* Copyright (C) 2003 Free Software Foundation.
Test memcpy and memset in presence of redirect. */
typedef
__SIZE_TYPE__
size_t
;
extern
void
abort
(
void
);
extern
void
*
memcpy
(
void
*
,
const
void
*
,
size_t
)
__asm
(
"my_memcpy"
);
extern
void
bcopy
(
const
void
*
,
void
*
,
size_t
)
__asm
(
"my_bcopy"
);
extern
void
*
memset
(
void
*
,
int
,
size_t
)
__asm
(
"my_memset"
);
extern
void
bzero
(
void
*
,
size_t
)
__asm
(
"my_bzero"
);
extern
int
memcmp
(
const
void
*
,
const
void
*
,
size_t
);
struct
A
{
char
c
[
32
];
}
a
=
{
"foobar"
};
char
x
[
64
]
=
"foobar"
,
y
[
64
];
int
i
=
39
,
j
=
6
,
k
=
4
;
int
main
(
void
)
{
struct
A
b
=
a
;
struct
A
c
=
{
{
'x'
}
};
if
(
memcmp
(
b
.
c
,
x
,
32
)
||
c
.
c
[
0
]
!=
'x'
||
memcmp
(
c
.
c
+
1
,
x
+
32
,
31
))
abort
();
if
(
__builtin_memcpy
(
y
,
x
,
i
)
!=
y
||
memcmp
(
x
,
y
,
64
))
abort
();
if
(
memcpy
(
y
+
6
,
x
,
j
)
!=
y
+
6
||
memcmp
(
x
,
y
,
6
)
||
memcmp
(
x
,
y
+
6
,
58
))
abort
();
if
(
__builtin_memset
(
y
+
2
,
'X'
,
k
)
!=
y
+
2
||
memcmp
(
y
,
"foXXXXfoobar"
,
13
))
abort
();
bcopy
(
y
+
1
,
y
+
2
,
6
);
if
(
memcmp
(
y
,
"fooXXXXfobar"
,
13
))
abort
();
__builtin_bzero
(
y
+
4
,
2
);
if
(
memcmp
(
y
,
"fooX
\0\0
Xfobar"
,
13
))
abort
();
return
0
;
}
/* There should be no calls to real memcpy, memset, bcopy or bzero. */
static
void
*
real_memcpy
(
void
*
,
const
void
*
,
size_t
)
__asm
(
"memcpy"
);
static
void
real_bcopy
(
const
void
*
,
void
*
,
size_t
)
__asm
(
"bcopy"
);
static
void
*
real_memset
(
void
*
,
int
,
size_t
)
__asm
(
"memset"
);
static
void
real_bzero
(
void
*
,
size_t
)
__asm
(
"bzero"
);
__attribute__
((
noinline
))
static
void
*
real_memcpy
(
void
*
d
,
const
void
*
s
,
size_t
n
)
{
abort
();
}
__attribute__
((
noinline
))
static
void
real_bcopy
(
const
void
*
s
,
void
*
d
,
size_t
n
)
{
abort
();
}
__attribute__
((
noinline
))
static
void
*
real_memset
(
void
*
d
,
int
c
,
size_t
n
)
{
abort
();
}
__attribute__
((
noinline
))
static
void
real_bzero
(
void
*
d
,
size_t
n
)
{
abort
();
}
__attribute__
((
noinline
))
void
*
memcpy
(
void
*
d
,
const
void
*
s
,
size_t
n
)
{
char
*
dst
=
(
char
*
)
d
;
const
char
*
src
=
(
const
char
*
)
s
;
while
(
n
--
)
*
dst
++
=
*
src
++
;
return
(
char
*
)
d
;
}
__attribute__
((
noinline
))
void
bcopy
(
const
void
*
s
,
void
*
d
,
size_t
n
)
{
char
*
dst
=
(
char
*
)
d
;
const
char
*
src
=
(
const
char
*
)
s
;
if
(
src
>=
dst
)
while
(
n
--
)
*
dst
++
=
*
src
++
;
else
{
dst
+=
n
;
src
+=
n
;
while
(
n
--
)
*--
dst
=
*--
src
;
}
}
__attribute__
((
noinline
))
void
*
memset
(
void
*
d
,
int
c
,
size_t
n
)
{
char
*
dst
=
(
char
*
)
d
;
while
(
n
--
)
*
dst
++
=
c
;
return
(
char
*
)
d
;
}
__attribute__
((
noinline
))
void
bzero
(
void
*
d
,
size_t
n
)
{
char
*
dst
=
(
char
*
)
d
;
while
(
n
--
)
*
dst
++
=
'\0'
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment