I want to use ‘st’ to store a register t1 into a float variable, so I use the following PTX code in my cuda code:
asm(“st.global.f32\t[%0], t1;\n\t” : “=r” (&C[n]) :);
compiler tells me something was wrong: st.cu(22): error: expression must be a modifiable lvalue; st.cu(22): error: an asm operand must have scalar type
if I change the code like this:
asm(“st.global.f32\t[%0], t1;\n\t” : “=f” (C[n]) :);
compiling is OK. However, the result is wrong!! Why??