xref: /openbmc/linux/arch/arm/lib/xor-neon.c (revision de9c0d49)
101956597SArd Biesheuvel /*
201956597SArd Biesheuvel  * linux/arch/arm/lib/xor-neon.c
301956597SArd Biesheuvel  *
401956597SArd Biesheuvel  * Copyright (C) 2013 Linaro Ltd <ard.biesheuvel@linaro.org>
501956597SArd Biesheuvel  *
601956597SArd Biesheuvel  * This program is free software; you can redistribute it and/or modify
701956597SArd Biesheuvel  * it under the terms of the GNU General Public License version 2 as
801956597SArd Biesheuvel  * published by the Free Software Foundation.
901956597SArd Biesheuvel  */
1001956597SArd Biesheuvel 
1101956597SArd Biesheuvel #include <linux/raid/xor.h>
129319206dSArd Biesheuvel #include <linux/module.h>
139319206dSArd Biesheuvel 
149319206dSArd Biesheuvel MODULE_LICENSE("GPL");
1501956597SArd Biesheuvel 
1601956597SArd Biesheuvel #ifndef __ARM_NEON__
17de9c0d49SNathan Chancellor #error You should compile this file with '-march=armv7-a -mfloat-abi=softfp -mfpu=neon'
1801956597SArd Biesheuvel #endif
1901956597SArd Biesheuvel 
2001956597SArd Biesheuvel /*
2101956597SArd Biesheuvel  * Pull in the reference implementations while instructing GCC (through
2201956597SArd Biesheuvel  * -ftree-vectorize) to attempt to exploit implicit parallelism and emit
2301956597SArd Biesheuvel  * NEON instructions.
2401956597SArd Biesheuvel  */
2501956597SArd Biesheuvel #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
2601956597SArd Biesheuvel #pragma GCC optimize "tree-vectorize"
2701956597SArd Biesheuvel #else
2801956597SArd Biesheuvel /*
2901956597SArd Biesheuvel  * While older versions of GCC do not generate incorrect code, they fail to
3001956597SArd Biesheuvel  * recognize the parallel nature of these functions, and emit plain ARM code,
3101956597SArd Biesheuvel  * which is known to be slower than the optimized ARM code in asm-arm/xor.h.
3201956597SArd Biesheuvel  */
3301956597SArd Biesheuvel #warning This code requires at least version 4.6 of GCC
3401956597SArd Biesheuvel #endif
3501956597SArd Biesheuvel 
3601956597SArd Biesheuvel #pragma GCC diagnostic ignored "-Wunused-variable"
3701956597SArd Biesheuvel #include <asm-generic/xor.h>
3801956597SArd Biesheuvel 
3901956597SArd Biesheuvel struct xor_block_template const xor_block_neon_inner = {
4001956597SArd Biesheuvel 	.name	= "__inner_neon__",
4101956597SArd Biesheuvel 	.do_2	= xor_8regs_2,
4201956597SArd Biesheuvel 	.do_3	= xor_8regs_3,
4301956597SArd Biesheuvel 	.do_4	= xor_8regs_4,
4401956597SArd Biesheuvel 	.do_5	= xor_8regs_5,
4501956597SArd Biesheuvel };
469319206dSArd Biesheuvel EXPORT_SYMBOL(xor_block_neon_inner);
47