Hardware software co-optimizations for efficient privacy preserving computing in AIoT devices