A prefetch method in a processor system comprising a compiler, a control register, a processor, at least one cache, and a hardware prefetcher for hardware prefetching of data from a memory system into said at least one cache, wherein the control register comprises a sequence of bits and a least significant bit is provided at a first end of the sequence of bits and a most significant bit is provided at an opposing end of the sequence of bits, the method comprising: • identifying, by the compiler, a source code segment in a source code program, wherein the source code segment is formed by a loop; • analyzing, by the compiler, a memory access pattern required by the source code segment; • if the memory access pattern is regular, using the compiler to: determine a prefetching stride based on the memory access pattern, insert before the source code segment a first instruction into the program, wherein the first instruction is used to set a value of the least significant bit of the control register to a value indicating an on state of the hardware prefetching and is used to set values of bits next to the least significant bit of the sequence of bits for indicating the prefetching stride, insert after the source code segment a second instruction into the program, wherein the second instruction is used to set the value of the least significant bit to a value indicating an off state of the hardware prefetching, compile the source code program equipped with the first and second instructions into a first object code; • if the memory access pattern is irregular, using the compiler to: insert at least one prefetching instruction into the source code segment, compile the source code program equipped with the at least one prefetching instruction into a second object code; • executing, by the processor, either the first object code, if the memory access pattern is regular, or the second object code, if the memory access pattern is irregular. • identifying, by the compiler, a source code segment in a source code program, wherein the source code segment is formed by a loop; • analyzing, by the compiler, a memory access pattern required by the source code segment; • if the memory access pattern is regular, using the compiler to: determine a prefetching stride based on the memory access pattern, insert before the source code segment a first instruction into the program, wherein the first instruction is used to set a value of the least significant bit of the control register to a value indicating an on state of the hardware prefetching and is used to set values of bits next to the least significant bit of the sequence of bits for indicating the prefetching stride, insert after the source code segment a second instruction into the program, wherein the second instruction is used to set the value of the least significant bit to a value indicating an off state of the hardware prefetching, compile the source code program equipped with the first and second instructions into a first object code; determine a prefetching stride based on the memory access pattern, insert before the source code segment a first instruction into the program, wherein the first instruction is used to set a value of the least significant bit of the control register to a value indicating an on state of the hardware prefetching and is used to set values of bits next to the least significant bit of the sequence of bits for indicating the prefetching stride, insert after the source code segment a second instruction into the program, wherein the second instruction is used to set the value of the least significant bit to a value indicating an off state of the hardware prefetching, compile the source code program equipped with the first and second instructions into a first object code; • if the memory access pattern is irregular, using the compiler to: insert at least one prefetching instruction into the source code segment, compile the source code program equipped with the at least one prefetching instruction into a second object code; insert at least one prefetching instruction into the source code segment, compile the source code program equipped with the at least one prefetching instruction into a second object code; • executing, by the processor, either the first object code, if the memory access pattern is regular, or the second object code, if the memory access pattern is irregular.