* [SH][committed] Add test case for PR 65153
@ 2015-03-07 19:36 Oleg Endo
0 siblings, 0 replies; only message in thread
From: Oleg Endo @ 2015-03-07 19:36 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 315 bytes --]
Hi,
This adds the test case for PR 65153.
Tested with
make -k check-gcc RUNTESTFLAGS="compile.exp=pr65153.c
--target_board=sh-sim
\{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"
Committed as r221257.
Cheers,
Oleg
gcc/testsuite/ChangeLog:
PR target/65153
* gcc.c-torture/compile/pr65153.c: New.
[-- Attachment #2: sh_pr65153_test.patch --]
[-- Type: text/x-patch, Size: 1449 bytes --]
Index: gcc/testsuite/gcc.c-torture/compile/pr65153.c
===================================================================
--- gcc/testsuite/gcc.c-torture/compile/pr65153.c (revision 0)
+++ gcc/testsuite/gcc.c-torture/compile/pr65153.c (revision 0)
@@ -0,0 +1,40 @@
+/* { dg-additional-options "-fPIC" { target fpic } } */
+
+typedef unsigned long word32;
+typedef unsigned char byte;
+typedef struct cast256_instance { word32 l_key[96];} cast256_key;
+word32 cast256_sbox[4][256] = {};
+void
+key (cast256_key *key, const word32 *in_key, const int key_len)
+{
+ word32 i, j, t, u, cm, cr, lk[8], tm[8], tr[8];
+ for (i = 0; i < 96; i += 8)
+ {
+ for (j = 0; j < 8; ++j)
+ {
+ tm[j] = cm;
+ cm += 0x6ed9eba1;
+ tr[j] = cr;
+ cr += 17;
+ }
+ t = (((tm[0] + lk[7]) << ((word32)(tr[0] & 31)))
+ | ((tm[0] + lk[7]) >> (32 - (word32)(tr[0] & 31))));
+ u = cast256_sbox[0][((byte)((t) >> (8 * 3)))];
+ u ^= cast256_sbox[1][((byte)((t) >> (8 * 2)))];
+ lk[7] ^= u;
+ for (j = 0; j < 8; ++j)
+ {
+ cm += 0x6ed9eba1;
+ tr[j] = cr;
+ cr += 17;
+ }
+ t = (((tm[0] + lk[7]) << ((word32)(tr[0] & 31)))
+ | ((tm[0] + lk[7]) >> (32 - (word32)(tr[0] & 31))));
+ u = cast256_sbox[0][((byte)((t) >> (8 * 3)))];
+ u ^= cast256_sbox[1][((byte)((t) >> (8 * 2)))];
+ u -= cast256_sbox[2][((byte)((t) >> (8 * 1)))];
+ lk[2] ^= u;
+ lk[7] ^= u;
+ key->l_key[i + 1] = lk[2];
+ }
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-03-07 19:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-07 19:36 [SH][committed] Add test case for PR 65153 Oleg Endo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).