1*ad85ac6aSIlya Leoshkevich /* 2*ad85ac6aSIlya Leoshkevich * Test the LARL instruction. 3*ad85ac6aSIlya Leoshkevich * 4*ad85ac6aSIlya Leoshkevich * SPDX-License-Identifier: GPL-2.0-or-later 5*ad85ac6aSIlya Leoshkevich */ 6*ad85ac6aSIlya Leoshkevich #include <stdlib.h> 7*ad85ac6aSIlya Leoshkevich main(void)8*ad85ac6aSIlya Leoshkevichint main(void) 9*ad85ac6aSIlya Leoshkevich { 10*ad85ac6aSIlya Leoshkevich long algfi = (long)main; 11*ad85ac6aSIlya Leoshkevich long larl; 12*ad85ac6aSIlya Leoshkevich 13*ad85ac6aSIlya Leoshkevich /* 14*ad85ac6aSIlya Leoshkevich * The compiler may emit larl for the C addition, so compute the expected 15*ad85ac6aSIlya Leoshkevich * value using algfi. 16*ad85ac6aSIlya Leoshkevich */ 17*ad85ac6aSIlya Leoshkevich asm("algfi %[r],0xd0000000" : [r] "+r" (algfi) : : "cc"); 18*ad85ac6aSIlya Leoshkevich asm("larl %[r],main+0xd0000000" : [r] "=r" (larl)); 19*ad85ac6aSIlya Leoshkevich 20*ad85ac6aSIlya Leoshkevich return algfi == larl ? EXIT_SUCCESS : EXIT_FAILURE; 21*ad85ac6aSIlya Leoshkevich } 22